
Public static readonly fields are recommended. They are used for types that cannot be represented as a const value in the C# language but is not subject to change during the execution of your program. Instead of using const, you can use public static readonly fields—this results in code more resistant to programmer errors.
Readonly FieldsThis C# article uses public static readonly fields. It describes the advantages of these fields.

This example program uses public static readonly fields. The language specification recommends using public static readonly fields when you cannot use a const field or when the field is subject to change in the future. Although readonly fields carry no performance penalty over normal fields, const fields are somewhat faster because they are inserted directly into the locations where they are used.
Class that uses public static readonly fields [C#]
using System.Drawing;
static class Points
{
//
// Defines four public static readonly fields on a static class.
//
public static readonly Point TopLeft = new Point(0, 0);
public static readonly Point TopRight = new Point(1, 0);
public static readonly Point BottomRight = new Point(1, 1);
public static readonly Point BottomLeft = new Point(0, 1);
// public const Point TopLeft = new Point(0, 0);
}
Program.cs with Main method [C#]
using System;
class Program
{
static void Main()
{
//
// Uses the public static readonly fields.
//
Console.WriteLine(Points.TopLeft);
Console.WriteLine(Points.TopRight);
Console.WriteLine(Points.BottomRight);
Console.WriteLine(Points.BottomLeft);
// Points.TopLeft = new System.Drawing.Point();
}
}
Output
{X=0,Y=0}
{X=1,Y=0}
{X=1,Y=1}
{X=0,Y=1}Tip: Add the System.Drawing assembly reference to compile this program.
Description. The first compilation unit in the program text defines a static class called Points that stores four Point references that are readonly fields. They use the public accessibility modifier so you can access them anywhere in the source code in your project. With static fields, you can use the constructor for a type and it is only executed once.
Point Struct
Using static readonly fields. The program text also defines the Main entry point for the application. The four Point references are loaded from the metadata and placed in parameter lists for the Console.WriteLine calls. The readonly Point fields will always have their constructors called before being used in the Main entry point because of the order that static constructors are executed.
Static Constructor
Errors are encountered when trying to use a const class or struct, and also when trying to assign a readonly field to a value outside of a variable declarator or constructor. These are both compile-time errors issued by the C# compiler, so the program can never be executed in the CLR.
This protects you from deploying bad code but can result in headaches if you are unfamiliar with the language. If you encounter these errors, try to remove the readonly modifier, or remove the assignment itself. You can also try to remove the const modifier if you are using that.
Error
A static readonly field cannot be assigned to (except in a static constructor or a variable initializer)
Error
The type 'System.Drawing.Point' cannot be declared const

The concept of using public static readonly fields to simulate constant class instances is demonstrated in the C# language specification itself. This indicates that this technique is both important enough to be emphasized in the primary reference material and the technique is effective. I recommend you check out the annotated C# language specification for the original example, which uses the Color class.
The C# Programming Language: Specification
We looked at a specific way of using constant fields for types that cannot be represented with the const modifier in the C# programming language. Specifically, we saw how the C# specification offers the strategy of using public static readonly fields. You can find many more details on static readonly fields in the chapter on classes in the annotated C# specification published by Microsoft Press. Additionally, we noted some errors related to readonly fields and const fields.
Class Examples