Retrieve the file in scope in C#

  • Thread starter Thread starter GruBByMaster
  • Start date Start date
G

GruBByMaster

Hello

I'm trying to build a function that retrieves the file in scope,
meaning that i'm building a log and i want to write in it the curent
file the debug is in. For example if i have a file called myClass.cs
and a method GetTotal() i want to have :
WriteToLog(string.Format( Function that returns the name of the file
in scope + "GetTotal() returned {0}", GetTotal()); instead of
WriteToLog(string.Format("myClass.cs - GetTotal() returned {0}",
GetTotal());

Thanks
 
Hi,

you may want to have a look at

System.Reflection.Assembly.GetCallingAssembly ()

and

System.Reflection.Assembly.GetExecutingAssembly()

Good luck,
Hans.
 
Back
Top