Monday 15 April 2013

.net - Get namespace in a static function -


In an example method, I can easily find the execution namespace:

  public Instead of zero printnames () {Console.WriteLine (This. GetType (.) Namespace); }  

Question: How do I do this in the Fixed function (no this is not available) without explicitly mentioning the square name? Can i do (Any typeof (MyClass) )

  console. WrightLine (typeof (TheClassThatContainsTheStaticFunction .namespace);  

or by using a reflection:

  console. WrightLine (MethodBase.GetCurrentMethod (. DeclaringType.Namespace);  

No comments:

Post a Comment