diff --git a/docs/csharp/misc/cs0131.md b/docs/csharp/misc/cs0131.md index 4cfff15eb88a9..3875c74c54325 100644 --- a/docs/csharp/misc/cs0131.md +++ b/docs/csharp/misc/cs0131.md @@ -33,14 +33,34 @@ public class MyClass } public static void Main() { } } -``` +``` + +## Example 2 + + The following sample generates CS0131 when assigning to a constant field. -## Example 2 +```csharp +// CS0131b.cs +public class B +{ + public static int Main() + { + const int j = 0; + j = 1; // CS0131 + // try the following lines instead + // int j = 0; + // j = 1; + return j; + } +} +``` + +## Example 3 This error can also occur if you attempt to perform arithmetic operations on the left hand side of an assignment operator, as in the following example. ```csharp -// CS0131b.cs +// CS0131c.cs public class C { public static int Main()