How To Get The Current Project Name And Class Name And Method Name Using Reflection

Get The Current Project Name And Class Name And Method Name Using Reflection

I keep having to lookup this C#.NET trick online.

So I am putting it here as a reminder to myself and for others too.

– This is one way how to get the current project-assembly name…

System.Reflection.Assembly.GetExecutingAssembly().GetName().Name

– This is one way how to get the current class name…

System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name

– This is one way how to get the current method name…

System.Reflection.MethodBase.GetCurrentMethod().Name

Advertisements

Author: mkamoski1

n/a