Skip to content

Commit 2a6a936

Browse files
authored
[UUF] Fix incorrect variable names in Console.WriteLine for Boolean code examples (#49439)
1 parent e0daf3a commit 2a6a936

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

docs/fundamentals/runtime-libraries/snippets/System/Boolean/Overview/csharp/binary1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static void Main()
1414
Console.WriteLine($"Binary value: {value} ({GetBinaryString(value)})");
1515
// Restore the flag from its binary representation.
1616
bool newFlag = BitConverter.ToBoolean(new Byte[] { value }, 0);
17-
Console.WriteLine($"Restored value: {flag}{Environment.NewLine}");
17+
Console.WriteLine($"Restored value: {newFlag}{Environment.NewLine}");
1818
}
1919
}
2020

docs/fundamentals/runtime-libraries/snippets/System/Boolean/Overview/csharp/size1.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ public static void Main()
2020
Console.WriteLine($"Size of BoolStruct: {sizeof(BoolStruct)}");
2121
Console.WriteLine("Field offsets:");
2222
Console.WriteLine($" flag1: {(bool*) &b.flag1 - addr}");
23-
Console.WriteLine($" flag1: {(bool*) &b.flag2 - addr}");
24-
Console.WriteLine($" flag1: {(bool*) &b.flag3 - addr}");
25-
Console.WriteLine($" flag1: {(bool*) &b.flag4 - addr}");
26-
Console.WriteLine($" flag1: {(bool*) &b.flag5 - addr}");
23+
Console.WriteLine($" flag2: {(bool*) &b.flag2 - addr}");
24+
Console.WriteLine($" flag3: {(bool*) &b.flag3 - addr}");
25+
Console.WriteLine($" flag4: {(bool*) &b.flag4 - addr}");
26+
Console.WriteLine($" flag5: {(bool*) &b.flag5 - addr}");
2727
}
2828
}
2929
}
3030
// The example displays the following output:
3131
// Size of BoolStruct: 5
3232
// Field offsets:
3333
// flag1: 0
34-
// flag1: 1
35-
// flag1: 2
36-
// flag1: 3
37-
// flag1: 4
34+
// flag2: 1
35+
// flag3: 2
36+
// flag4: 3
37+
// flag5: 4
3838
// </Snippet14>

docs/fundamentals/runtime-libraries/snippets/System/Boolean/Overview/vb/binary1.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Module Example1
1313
GetBinaryString(value))
1414
' Restore the flag from its binary representation.
1515
Dim newFlag As Boolean = BitConverter.ToBoolean({value}, 0)
16-
Console.WriteLine("Restored value: {0}", flag)
16+
Console.WriteLine("Restored value: {0}", newFlag)
1717
Console.WriteLine()
1818
Next
1919
End Sub

0 commit comments

Comments
 (0)