C# Static method | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C# Static method

How to write a static method that contains a static integer such that the first time it within a running program it returns 0 and each subsequent time is called it returns a number that greater than by 1 what it returned for the previous call.

4th Feb 2020, 5:51 AM
Microne mafika
Microne mafika - avatar
2 Answers
0
Static members will be called once in the program execution.. so static members will be initialized once. Not like instance members , instance members initialized whenever you create object
12th Apr 2020, 5:50 PM
vinod kumar
vinod kumar - avatar