Location location = new Location("file.cs", 10);
void SomeMethod() { Location location = Location.GetCallingLocation(); Console.WriteLine("Error at {0}:{1}", location.FileName, location.Line); }This method uses the static method GetCallingLocation() to get the location of the method that called it. It then prints out the file name and line number. Package library: Mono.CSharp.