Can we use this keyword in C# ?
If no, why can't we use ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Gnanavel SekarPosted Mar 23, 2017, 7:34 AM
Sandip G PatilPosted Mar 23, 2017, 9:20 AM
Harisankar AngamuthuPosted Mar 23, 2017, 7:15 AM
Gnanavel SekarPosted Mar 23, 2017, 2:38 AM
Paul RajsPosted Mar 23, 2017, 2:09 AM
Because
thisrefers to the object instance. There is no object instance in a call of a static method. But of course you can access your static field (only the static ones!). Just useIf you want to make sure you get the static field
yand not some local variable with the same name, use the class name to specify:Sreekanth ReddyPosted Mar 23, 2017, 1:36 AM
Sreekanth ReddyPosted Mar 23, 2017, 1:32 AM
Jitendra ShekhawatPosted Mar 23, 2017, 1:32 AM
Suvendu Shekhar GiriPosted Mar 23, 2017, 1:30 AM
Paul RajsPosted Mar 23, 2017, 1:16 AM