C#nameof用法
作者:互联网
原文链接:http://www.cnblogs.com/LifeDecidesHappiness/p/9857449.html
1.实现代码
using System; namespace NameofUsage { /// <summary> /// C# nameof用法 /// </summary> internal class Program { private static void Main() { Console.Title = "C# nameof用法"; Person p = new Person(); Console.WriteLine(nameof(p)); Console.WriteLine(nameof(p.Name)); Console.WriteLine(nameof(Person.CreateDateTime)); Console.ReadKey(); } } public class Person { public long Id { get; set; } public string Name { get; set; } public DateTime CreateDateTime { get; set; } } }
2.运行效果
转载于:https://www.cnblogs.com/LifeDecidesHappiness/p/9857449.html
标签:set,Console,C#,用法,Person,WriteLine,nameof,public 来源: https://blog.csdn.net/weixin_30814223/article/details/96731517