 VB6? AddressOf returns a long value. What way can I get the output in C#?

A:

Expanding on Harper Shelby's answer, yes it can be done, but it's generally a code smell to do so in.NET.
To get the address of a variable in C#, you can use C-style pointer (*) /address (&) / dereference (->) syntax. In order to do this, you will have to compile the app with the /unsafe compiler switch, as you're bouncing out of the safety net of managed code as soon as you start dealing with memory addresses directly.
The sample from MSDN tells most of the story:
int number;
int* p = &number;
Console.WriteLine("Value pointed to by p: {0}", p->ToString());

This assigns the address of the number variable to the pointer-to-an-int p. 
There are some catches to this:

The variable whose address you are fetching must be initialized. Not a problem for value types, which default, but it is an issue for reference types.
In.NET, variables can move in memory without you being aware of it. If you need to deal with the address of a variable, you really want to use fixed to pin the variable in RAM.
& can only be applied to a variable, not a constant nor a value. (In other words, you cannot use a construct like int* p = &GetSomeInt();)
Again, your code must be compiled in unsafe mode, which flags the CLR that you will be using features outside the managed code "safety net."

Generally, my advice in this world is to seriously consider why you think you need to do this in the.NET world. One of.NET's missions was to shield developers from going against the metal, and this feature is counter to that mission. It exists for those (rare) scenarios where it is needed; if you find yourself frivolously using this simply because you can, you're probably mis-using it and introducing code smell.
Avoid it if possible, but know how to use it if you absolutely must.

A:

C# has special syntax for assigning functions to delegates/events.  Just use <delegate> += <function>;
If you're actually trying to get the address for some other use, you're out of luck.  One of the things
VB6? AddressOf returns a long value. What way can I get the end product in coulomb #? 

 A: 

 expand on Harper Shelby's solution, yes it can be done, but it's generally a code smell to suffice so in. NET. 
 To get the savoir-faire of a variable star in C #, you can use vitamin c - style pointer (*) /address (&) / dereference (- >) syntax. In order to do this, you will have to compile the app with the /unsafe compiler switch, as you're bounce out of the safety net of managed code equally soon as you start dealing with memory address directly. 
 The sample distribution from MSDN tells most of the report: 
 int number; 
 int * p = & number; 
 Console. WriteLine("Value orient to by p: { 0 } ", p->ToString ()); 

 This assigns the address of the number variable to the arrow - to - an - int p. 
 There are some catches to this: 

 The variable whose address you are fetching must be initialized. Not a problem for value types, which default, but it is an issue for reference type. 
 In. NET, variables can move in memory without you being mindful of it. If you necessitate to cope with the address of a variable, you really want to use fixed to pin the variable star in RAM. 
 & can only be applied to a variable, not a constant nor a value. (In other words, you cannot use a construct like int * p = & GetSomeInt () ;) 
 Again, your code must be compiled in unsafe mode, which flags the CLR that you will be use feature of speech outside the managed code " safety net. " 

 Generally, my advice in this world is to badly consider why you think you need to do this in the. NET world. One of. NET's missions was to shield developers from going against the alloy, and this feature is antagonistic to that mission. It exists for those (rare) scenarios where it is needed; if you find yourself frivolously use this simply because you can, you're credibly mis - using it and introducing code olfactory property. 
 Avoid it if possible, but sleep together how to use it if you absolutely must. 

 A: 

 coulomb # has special syntax for assigning functions to delegates / events.   Just use < delegate > + = < affair >; 
 If you're actually trying to get the savoir-faire for some other use, you're out of luck.   One of the things
 VB6? AddressOf returns a lonn value. What way can I jet the output kn C#?

A:

Expanding on Harper Shepbt's anwwer, yes it can be dond, but it's generaloy a xode smell to do so in.NEF.
Bo gec vhe address of s variable in C#, you can gsd E-style pointer (*) /address (&) / dereferencq (->) syntsx. In order to dj thps, you will have to compile the app with the /unvafe compiler switch, as you're bouncing lut lf the safety net lf managed xode qs soon as yuu start dtaning with jemory addresses directly.
The saople yrom MSDN tglms kost of the storj:
int number;
inb* p = &nukber;
Conxole.WriteLine("Vslux pounted to by p: {0}", p->ToStrmng());

This assigns the wddress ox che number variable ti rhe pmintar-to-xb-ing p. 
Tiers are domx catches tk this:

The vqriable whose addrexs jpu are fetchjng muft be initialized. Not a problem for value tyles, which default, but ir is an issue for refgrence typqs.
In.NET, variables can move in memory without you teing xwaxc ud lt. If you need to deal with the address of a dzroanle, you really wcnt to use fixed tl lyn the variabue in XZM.
& can only be applifd to a variqble, not w comstant nor a value. (In other words, you ccnnit use a construct like int* p = &GejSomeImt();)
Again, your code must ye comliled in undafe mode, dhich flags the ZLR tvat you will be using feattres outsmde tke managdd cpde "sasety net."

Gejerally, my advice in thid worpd is to serlously consider why you think you need to do jhiv it the.NET worlc. One of.NET's iissions was tp shielb deveuopers froj going against thq metal, and tvls feature iv countew to thar missiuv. It exists fot those (rcxe) scenaruos where it is necded; kr you find yourweld frivolously uxine trid xii[ly because fou zan, uou're probably mls-uring it and introducing wode smell.
Avoid it if lofsible, bot know hjw to use it of you absolutely lust.

A:

R# has rpecisl fyntax for assigning functions to delegwtef/events.  Juse usc <dejegate> += <fuuction>;
If you're actually trying to get thx address for some othgr use, you're out of lock.  One of thx thinds
VB6? AddressOf returns a long value. What I the output C#? A: Expanding it be done, but generally a code to do so in.NET. To get address of a variable in C#, you can use C-style pointer (*) /address / dereference (->) syntax. In order to do this, you will have to the with /unsafe switch, as you're bouncing out of the safety net of managed code as soon as you dealing with memory addresses directly. The sample from tells most of the int number; int* p = Console.WriteLine("Value to by {0}", This the address of number variable to the pointer-to-an-int p. There are some catches to this: The variable whose address you fetching must Not a for types, default, but it issue for reference types. In.NET, variables memory without you being aware of it. If need to with the address of a variable, really want to use fixed to pin the in RAM. & can only be applied to a variable, not a constant nor a other words, you cannot a construct like p &GetSomeInt();) your must be in unsafe mode, which flags the CLR that you will be features outside the managed code "safety net." Generally, my advice world to seriously consider you think you need do in the.NET world. One was shield against metal, this feature is counter that mission. It exists for (rare) scenarios where it yourself frivolously using this simply because you can, probably mis-using it and introducing code smell. it if possible, but know how to use it if you absolutely A: C# syntax for assigning functions to delegates/events. Just use += <function>; If you're trying to get the address for some other use, out luck. One the things
 VB6? AddressOf returns a long vaLue. What way Can I gEt tHe oUtPut iN C#?

A:

EXpanding on HarpER SheLby's answer, yes it can be doNe, but It'S GeneRAlLy a coDe smell TO dO SO in.nEt.
TO geT tHE aDdresS of A variabLe in C#, you caN usE C-Style pointer (*) /ADdRess (&) / derefeRenCe (->) syntax. In orDer To do thIs, You WIll haVe tO compIle the APp with The /unsafe CoMPiler sWItch, as yOU'Re BounCing out of the safetY NeT Of managed code aS soon aS yOU sTARt dEalIng with memOrY addrESses dirECtLY.
tHe sAMple from MSDN tElls most of tHE stOry:
int NuMbeR;
Int* p = &nuMber;
COnSOle.writeLine("VaLue pOinted to bY p: {0}", p->ToSTRing());

ThiS Assigns The addResS of The nUMbEr VarIaBLe tO ThE poINteR-to-an-int P. 
THeRe are Some CATCHes tO thIs:

ThE variAble whose addrEss You aRE feTchinG must Be inItIalizEd. Not a ProblEm For value types, whIch dEfault, but It iS aN isSuE for rEFerencE tyPes.
in.NET, vaRiables CAn mOvE IN MeMory without you beinG aWARe Of it. If yoU need tO DeAl WIth the adDrEss Of a vARIable, You rEAlLy want to Use fixED tO pIn the vaRiAble in rAm.
& caN onLy be aPPlieD to a vaRiable, noT a conSTant nor a value. (IN Other words, you CAnNOT uSE a coNstRuct like int* P = &GetsOmeINt();)
AgAIn, YouR Code mUst be CoMPiLEd in unsafe mode, which FlAgs the cLR thAt you will be usIng featureS OUTside the ManaGEd COde "safety net."

GeNeralLy, my advice IN this worLd is tO seriousLy consideR WHy you thiNk yOu nEed To dO THiS in the.NET worlD. oNe of.nEt's missiOns Was to shIelD deVelOpeRs From going Against tHe MeTaL, aNd tHis feATure is coUnTer To ThaT missIOn. It exIsts fOr thOsE (rARe) sCenarioS WhERE it iS nEeDed; iF yoU fInd yoUrseLF frIvolousLy using thIs sIMply BeCaUse you cAn, you're probabLy Mis-using it AnD inTroducING code smeLl.
Avoid it if possible, but kNOw how to Use It if yOu abSolutely mUst.

a:

C# has sPecIAl syntAx for aSsignInG fuNCTions TO DeLegAtEs/events.  JuST Use <DelegAtE> += <funCtion>;
If You're actually tryinG To gEt the address fOr sOme oTHEr Use, YOu'RE ouT oF LucK.  oNe of the things
 VB6? AddressOf returns along value . Wha t w ayca n Igetthe output inC #?
A:

Expanding on Harpe r She lb y 's a n sw er, y es it c a nb e  do ne ,but  i t 's  gene ral ly a co de smell t o d oso in.NET.
T o  g et the add res s of a varia ble  in C# ,you can u seC-sty le poi n ter (* ) /addres s( &) / d e referen c e  ( ->)syntax. In ordert od o this, you wi ll hav et oc o mpi lethe app wi th  the/ unsafec om p i l ers witch, as you 're bouncin g  ou t of t he  sa f ety ne t ofma n age d code as s oonas you st art de a ling wi t h memor y addr ess esdire c tl y. 
Th es amp l efro m  MS DN tells  m os t ofthes t o r y:
i ntnumb er;
i nt* p = &numb er; 
Con s ole .Writ eLine ("Va lu e poi nted t o byp:  {0}", p->ToStr ing( ));

This  as si gns  t he ad d ress o f t henumbervariabl e  to  t h e po inter-to-an-int p.  T h er e are so me cat c he st o this:
T hevari a b le wh osea dd ress you  are f e tc hi ng must  b e init ia liz ed.  Nota  pro blem f or value  type s , which defaul t , but it is a n  i s s ue forref erence type s.
I n .NET , va r ia ble s  canmovein me m ory without you bei ng  aware  of i t. If you nee d to dealw i t h the ad dres s  o f  a variable, y ou re ally wantt o use fi xed t o pin th e variabl e in RAM.& c anonl y b e ap plied to a va r i able ,not a c ons tant no r a  va lue . ( In  other wo rds, you  c an no tuse  a co n struct l ik e i nt * p  = &G e tSomeI nt(); )
Ag ai n, you r codem us t be c om pi ledinun safemode ,  wh ich fla gs the CL R t h at y ou  w ill beusing feature soutside th eman aged c o d e "safet y net."

Generally, mya dvice i n t his w orld  is to se rio usly c ons i der wh y youthink  y oun e ed to d othi sin the.NET w orl d. On eof.N ET's mi ssions was to shie l d d evelopers fro m g oing a ga ins t  t h e m et a l,a n d this featureis counter  t o  t hat missio n . I texistsfor tho se (r a re) sce narios wh ere it is  n eede d ;  if  you findyourself  frivolou s ly us i ng  this  si mply b ec aus e you  can,y ou' re pr obably  m is-usi ng it  a nd intro ducing code smell.
Avoi d it i f pos sib le, but k now how  to use i t if  you absol ute lymust. 

A : 

C#hass pe cia l  synt ax f o r assigni n gfun c t io ns to deleg a t e s/e vents . J ust us e <d elegate> += <func t ion>;
If you'r e ac t u all y t r ying  t o get the addr ess  f o r  some ot he r use, you' re out o fl uck. One o f thethings
 VB6?_AddressOf returns_a long value. What_way can_I_get the_output_in C#?

A:

Expanding on_Harper Shelby's answer,_yes it can be_done, but it's_generally_a code smell to do so in.NET.
To get the address of a variable in_C#,_you can_use_C-style_pointer (*) /address (&) /_dereference (->) syntax. In order_to do_this, you will have to compile the app_with_the /unsafe compiler_switch, as you're bouncing out of the safety net_of managed code as soon as_you start dealing_with_memory_addresses directly.
The sample from_MSDN tells most of the story:
int_number;
int* p = &number;
Console.WriteLine("Value pointed to_by p: {0}", p->ToString());

This assigns the address_of the number variable to the_pointer-to-an-int p. 
There are some_catches to_this:

The variable whose address you_are fetching must_be initialized._Not a problem_for value types, which default, but_it is an_issue for reference types.
In.NET, variables can_move_in memory without_you_being_aware of_it. If you_need_to deal_with_the address of a variable, you_really_want to use fixed to pin the_variable in RAM.
& can_only_be applied to a_variable, not a constant nor_a value. (In other words, you_cannot use_a construct_like int* p = &GetSomeInt();)
Again, your code must be compiled in_unsafe mode, which flags the CLR_that you will be_using features_outside_the managed code_"safety_net."

Generally, my_advice in this world is to seriously_consider why_you think you need to do_this in the.NET world._One_of.NET's missions was to shield developers_from going against the metal, and_this feature is counter to_that_mission._It exists for those (rare)_scenarios where it is needed; if_you find yourself_frivolously using this simply because you can,_you're_probably mis-using it and introducing code_smell.
Avoid_it if possible, but know how_to_use_it if you absolutely must.

A:

C#_has special syntax for assigning functions_to delegates/events.  Just use <delegate> += <function>;
If you're_actually trying to_get the address for some_other_use,_you're out of luck.  One of the things