Generic pointers C# with Example



Generic pointers C# with Example

The criteria that a type must satisfy in order to support pointers (see Remarks) cannot be expressed in terms of 
generic constraints. Therefore, any attempt to declare a pointer to a type provided through a generic type 
parameter will fail. 
void P(T obj) 
where T : struct 
{ 
T* ptr = &obj; // compile-time error 
} 
 

0 Comment's

Comment Form

Submit Comment