Why doesn't C# support local static variables like C does? -


क्यों नहीं सी # स्थानीय स्थिर चर जैसे सी है? मुझे लगता है कि !!

आप एक प्रतिनिधि का उपयोग करके इसे अनुकरण कर सकते हैं ... यहां मेरा नमूना कोड है:

  सार्वजनिक फ़ंक्शन & lt; int & gt; वृद्धि () {int num = 0; नया फ़नक वापस जाएं & lt; int & gt; (() = & gt; {num num ++;}); }  

आप इसे इस तरह से कॉल कर सकते हैं:

  फ़ंक्शन & lt; int & gt; Inc = वृद्धि (); इंक ();  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -