Napomena
Pristup ovoj stranici zahteva autorizaciju. Možete pokušati da se prijavite ili da promenite direktorijume.
Pristup ovoj stranici zahteva autorizaciju. Možete pokušati da promenite direktorijume.
Cannot take the address of, get the size of, or declare a pointer to a managed type ('type')
Even when used with the unsafe keyword, taking the address of a managed object, getting the size of a managed object, or declaring a pointer to a managed type is not allowed. A managed type is:
any reference type
any struct that contains a reference type as a field or property
For more information, see Unmanaged types.
The following sample generates CS0208:
// CS0208.cs
// compile with: /unsafe
class myClass
{
public int a = 98;
}
struct myProblemStruct
{
string s;
float f;
}
struct myGoodStruct
{
int i;
float f;
}
public class MyClass
{
unsafe public static void Main()
{
// myClass is a class, a managed type.
myClass s = new myClass();
myClass* s2 = &s; // CS0208
// The struct contains a string, a managed type.
int i = sizeof(myProblemStruct); //CS0208
// The struct contains only value types.
i = sizeof(myGoodStruct); //OK
}
}
Povratne informacije za .NET
.NET je projekat otvorenog koda. Izaberite vezu da biste pružili povratne informacije: