From 8f3d95bede39eca378477b0212f3c237fba7763e Mon Sep 17 00:00:00 2001 From: sator-imaging <16752340+sator-imaging@users.noreply.github.com> Date: Sun, 2 Jun 2024 21:56:34 +0900 Subject: [PATCH] docs: fix inconsistent indentation & more --- README.md | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 32361b9..e7c1b33 100644 --- a/README.md +++ b/README.md @@ -66,20 +66,20 @@ class B { public static class Test { - public static void Main() - { - System.Console.WriteLine(A.Value); // 620 - System.Console.WriteLine(A.Other); // 310 - System.Console.WriteLine(B.Value); // 0 👈👈👈 - System.Console.WriteLine(B.Other); // 620 + public static void Main() + { + System.Console.WriteLine(A.Value); // 620 + System.Console.WriteLine(A.Other); // 310 + System.Console.WriteLine(B.Value); // 0 👈👈👈 + System.Console.WriteLine(B.Other); // 620 // when changing class member access order, it works correctly 🤣 - // see the following for details - //System.Console.WriteLine(B.Value); // 310 👈 correct!! - //System.Console.WriteLine(B.Other); // 620 - //System.Console.WriteLine(A.Value); // 620 - //System.Console.WriteLine(A.Other); // 310 - } + // see the following section for detailed explanation + //System.Console.WriteLine(B.Value); // 310 👈 correct!! + //System.Console.WriteLine(B.Other); // 620 + //System.Console.WriteLine(A.Value); // 620 + //System.Console.WriteLine(A.Other); // 310 + } } ``` @@ -94,6 +94,14 @@ public static class Test - `A.Other = 310;` // initialized here!! this value is not assigned to B.Value +When reading B value first, initialization order is changed and resulting value is also changed accordingly: + +- `B.Other = 620;` +- `B.Value = A.Other;` + - `A.Value = B.Other;` // correct: B.Other is initialized before reading value + - `A.Other = 310;` + +