G
Guest
Hello,
I have been trying to write code with generics. But following syntax is bad,
in my opinion it shouldn't be.
--- CODE ---
public unsafe void Test2(void* data)
{
....
}
public unsafe void Test<T>(T value) where T : struct
{
Test2((void*)&value);
}
--- END CODE ---
Compiler says that "Cannot take the address of, get the size of, or declare
a pointer to a managed type ('T')"
but T is value type...
Is there any other solution's?
Sorry about my english...
Thanks.
I have been trying to write code with generics. But following syntax is bad,
in my opinion it shouldn't be.
--- CODE ---
public unsafe void Test2(void* data)
{
....
}
public unsafe void Test<T>(T value) where T : struct
{
Test2((void*)&value);
}
--- END CODE ---
Compiler says that "Cannot take the address of, get the size of, or declare
a pointer to a managed type ('T')"
but T is value type...
Is there any other solution's?
Sorry about my english...
Thanks.