How to declare a constant Guid in C#?

前端 未结 5 1790
暗喜
暗喜 2020-12-10 10:17

Is it possible to declare a constant Guid in C#?

I understand that I can declare a static readonly Guid, but is there a syntax that allows me to write

5条回答
  •  一个人的身影
    2020-12-10 10:43

    I am doing it like this:

    public static class RecordTypeIds
    {
        public const string USERS_TYPEID = "5C60F693-BEF5-E011-A485-80EE7300C695";
        public static Guid Users { get { return new Guid(EntityTypeIds.USERS_TYPEID); } }
    }
    

提交回复
热议问题