Skip to content

Easy static method question

This Dia

Asked Aug 23, 2006, 5:48 AM EDT1 answer
Share
LinkedInX
Hello guys,
I am new to C# and I have encountered a problem.

I need to have a static method in a class that will return me the object of that class.
Something like this:
Class C
Public static void DoSomething() {}

and in the main
C c = DoSomething()

Can anybody help me please. What can I put instead of void in the method so I can have the solution?

Thank you
 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    you put instead of void Object keyword; for example public static Object DoSomething() { Object o; //what want you into variable o :) return o; } public static void Main() { Object a = DoSomething(); }
    0