How to declare a constant Guid in C#?

smartcaveman picture smartcaveman · Feb 7, 2011 · Viewed 44.6k times · Source

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 const Guid?

Answer

Quick Joe Smith picture Quick Joe Smith · Feb 7, 2011

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.