Use Qualified Nameof - CSharp Custom Type

CSharp examples for Custom Type:nameof

Description

Use Qualified Nameof

Demo Code

using System;/*from  w ww  .j  ava  2 s .  com*/
using System.ComponentModel;
class OtherClass
{
   public static int StaticMember => 3;
   public int InstanceMember => 3;
}
class QualifiedNameof
{
   static void Main()
   {
      OtherClass instance = null;
      Console.WriteLine(nameof(instance.InstanceMember));
      Console.WriteLine(nameof(OtherClass.StaticMember));
      Console.WriteLine(nameof(OtherClass.InstanceMember));
   }
}

Result


Related Tutorials