Probably you should consider an alternative:
class MyClass
{
public readonly string File;
public readonly int Line;
public MyClass( [CallerFilePath] string file = null, [CallerLineNumber] int line = 0 )
{
File = file;
Line = line;
}
public string MyInstanceLocation( )
{
return Path.GetFileName( File ) + " " + Line;
}
}
. . .
MyClass myclass1 = new MyClass();
This offers the file and the line of the instantiation, which is useful too.