Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi friends

I've this function in a unmanaged dll file :
CLIENT_Init(DisConnectFunc, (unsigned long)this);


I've to redefine this header into C# to use it in my C# project,

It's clear that "this" refer the class: but how to convert "
(unsigned long)this
" into C#, I'cant find any equivalence, help plz
Posted

Did you try this.Handle?
 
Share this answer
 
C# doesn't have pointers ( except for unsafe code ). Objects are moved around in memory by the Garbage Collector, so this in C# is only a reference to an object, not a pointer to memory. This means casting it to an integer type will not work.

Nick
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900