[llvm] Fix JIT support.
[mono.git] / mcs / docs / ecma334 / 17.4.2.1.xml
1 <?xml version="1.0"?>
2 <clause number="17.4.2.1" title="Using static readonly fields for constants">
3   <paragraph>A static readonly field is useful when a symbolic name for a constant value is desired, but when the type of the value is not permitted in a const declaration, or when the value cannot be computed at  compile-time. <example>[Example: In the example <code_example><![CDATA[
4 public class Color  
5 {  
6    public static readonly Color Black = new Color(0, 0, 0);  
7    public static readonly Color White = new Color(255, 255, 255);  
8    public static readonly Color Red = new Color(255, 0, 0);  
9    public static readonly Color Green = new Color(0, 255, 0);  
10    public static readonly Color Blue = new Color(0, 0, 255);  
11    private byte red, green, blue;  
12    public Color(byte r, byte g, byte b) {  
13       red = r;  
14       green = g;  
15       blue = b;  
16    }  
17 }  
18 ]]></code_example>the Black, White, Red, Green, and Blue members cannot be declared as const members because their values cannot be computed at compile-time. However, declaring them static readonly instead has much the same effect. end example]</example> </paragraph>
19 </clause>