I'm used to Objective-C and so I know that to create a singleton method all I do is this:
+ (void)myMethod
and to call it I type
#import MyClass;
[MyClass myMethod];
How do I do the same thing in C#?
I'm used to Objective-C and so I know that to create a singleton method all I do is this:
+ (void)myMethod
and to call it I type
#import MyClass;
[MyClass myMethod];
How do I do the same thing in C#?
 
    
    Here is the closest thing to your code in C# (it is not exactly the same, because in Objective-C you can "override" static methods, but in C# you cannot).
class MyClass {
    static public void MyMethod() {
        // Do something
    }
}
public class Program {
    public static void Main(string[] args) {
        MyClass.MyMethod();
    }
}
 
    
    I don't really understand from this debate what you really need. Here is the singleton pattern in C#:
public class MyClass
{
    private static MyClass instance;
    private MyClass()
    {
    }
    public static GetInstance()
    {
        if(instance == null)
            instance = new MyClass();
        return instance;
    }
}
