How to declare a constant Guid in C#?

前端 未结 5 1784
暗喜
暗喜 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:36

    No. The const modifier only applies to "primitive" types (bool, int, float, double, long, decimal, short, byte) and strings. Basically anything you can declare as a literal.

提交回复
热议问题