Current Instance Namespace?

  • Thread starter Thread starter localhost
  • Start date Start date
L

localhost

How to use Reflection to get the name of the namespace of the current
instance of a class?

Thanks.
 
Hello localhost,

Not necessary to use Reflection...

Try this:

string ns = this.GetType().Namespace; // C#
Dim ns As String = Me.GetType().Namespace '; VB
 
Not necessary to use Reflection...

Try this:

string ns = this.GetType().Namespace; // C#
Dim ns As String = Me.GetType().Namespace '; VB


Well, here you *are* using reflection.



Mattias
 
Hello Mattias,

Technically, yes... However, you're not importing the System.Reflection namespace.
 
Back
Top