This is the name of the variable, not the name of the object. This also raises the question: what is called here:
Information foo, bar; foo = bar = new Information();
You cannot do this for designers, etc .; in limited scenarios, you can get the variable name through Expression if you really want to:
public static void Main() { Information dataInformation = new Information(); Write(() => dataInformation); } static void Write<T>(Expression<Func<T>> expression) { MemberExpression me = expression.Body as MemberExpression; if (me == null) throw new NotSupportedException(); Console.WriteLine(me.Member.Name); }
Note that this depends on the capture implementation, etc. and usually cheeky.
source share