Sometimes you are asked to get/find Assembly name of a class.
You can use below code to get/find Assembly Name in VB.Net,
Dim assembly As System.Reflection.Assembly = System.Reflection.Assembly.GetAssembly(GetType(Class1))
Response.Write(assembly.GetName().Name)
You can use below code to get/find Assembly Name in C#,
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetAssembly(typeof(Class1));
Response.Write(assembly.GetName().Name);
Here in above code Assembly.GetAssembly Method gets the currently loaded assembly in which the specified class is defined.
No comments:
Post a Comment