@@ -584,8 +584,8 @@ The following example demonstrates the effect of the ASCII encoding on character
584
584
## Remarks
585
585
The <xref:System.Text.UnicodeEncoding> object that is returned by this property may not have the appropriate behavior for your app. It uses replacement fallback to replace each string that it cannot encode and each byte that it cannot decode with a question mark ("?") character. Instead, you can call the <xref:System.Text.UnicodeEncoding.%23ctor%28System.Boolean%2CSystem.Boolean%2CSystem.Boolean%29?displayProperty=nameWithType> constructor to instantiate a big endian <xref:System.Text.UnicodeEncoding> object whose fallback is either an <xref:System.Text.EncoderFallbackException> or a <xref:System.Text.DecoderFallbackException>, as the following example illustrates.
586
586
587
- [! code- csharp[System.Text.Encoding.BigEndianUnicode#2]( ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CS/bigendianunicode1.cs#2)]
588
- [! code-vb[System.Text.Encoding.BigEndianUnicode#2]( ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/VB/bigendianunicode1.vb#2)]
587
+ ::: code language=" csharp" source=" ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CS/bigendianunicode1.cs" interactive="try-dotnet" id="Snippet2":::
588
+ ::: code language="vb" source=" ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/VB/bigendianunicode1.vb" id="Snippet2":::
589
589
590
590
The returned <xref:System.Text.UnicodeEncoding> object has <xref:System.Text.Encoding.BodyName%2A>, <xref:System.Text.Encoding.HeaderName%2A>, and <xref:System.Text.Encoding.WebName%2A> properties, which yield the name "unicodeFFFE". Although the UTF-16 big endian byte order mark is hexadecimal FEFF, the name "unicodeFFFE" was chosen because the byte order mark appears as hexadecimal FFFE on little endian Windows computers.
591
591
@@ -598,9 +598,9 @@ The following example demonstrates the effect of the ASCII encoding on character
598
598
599
599
The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.
600
600
601
- [! code- cpp[System.Text.Encoding.GetBytes_CharArr#1]( ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp#1)]
602
- [! code- csharp[System.Text.Encoding.GetBytes_CharArr#1]( ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CS/getbytes_chararr.cs#1)]
603
- [! code-vb[System.Text.Encoding.GetBytes_CharArr#1]( ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/VB/getbytes_chararr.vb#1)]
601
+ ::: code language=" cpp" source=" ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp" id="Snippet1":::
602
+ ::: code language=" csharp" source=" ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CS/getbytes_chararr.cs" interactive="try-dotnet" id="Snippet1":::
603
+ ::: code language="vb" source=" ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/VB/getbytes_chararr.vb" id="Snippet1":::
604
604
605
605
]]> </format >
606
606
</remarks >
@@ -1311,9 +1311,9 @@ On .NET Core, the <xref:System.Text.Encoding.Default%2A> property always returns
1311
1311
## Examples
1312
1312
The following example gets two instances of the same encoding (one by codepage and another by name), and checks their equality.
1313
1313
1314
- [! code- cpp[System.Text.Encoding.Equals#1]( ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CPP/equals.cpp#1)]
1315
- [! code- csharp[System.Text.Encoding.Equals#1]( ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CS/equals.cs#1)]
1316
- [! code-vb[System.Text.Encoding.Equals#1]( ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.Equals/VB/equals.vb#1)]
1314
+ ::: code language=" cpp" source=" ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CPP/equals.cpp" id="Snippet1":::
1315
+ ::: code language=" csharp" source=" ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CS/equals.cs" interactive="try-dotnet" id="Snippet1":::
1316
+ ::: code language="vb" source=" ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.Equals/VB/equals.vb" id="Snippet1":::
1317
1317
1318
1318
]]> </format >
1319
1319
</remarks >
@@ -1396,9 +1396,9 @@ On .NET Core, the <xref:System.Text.Encoding.Default%2A> property always returns
1396
1396
## Examples
1397
1397
The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.
1398
1398
1399
- [! code- cpp[System.Text.Encoding.GetBytes_CharArr#1]( ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp#1)]
1400
- [! code- csharp[System.Text.Encoding.GetBytes_CharArr#1]( ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CS/getbytes_chararr.cs#1)]
1401
- [! code-vb[System.Text.Encoding.GetBytes_CharArr#1]( ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/VB/getbytes_chararr.vb#1)]
1399
+ ::: code language=" cpp" source=" ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp" id="Snippet1":::
1400
+ ::: code language=" csharp" source=" ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CS/getbytes_chararr.cs" interactive="try-dotnet" id="Snippet1":::
1401
+ ::: code language="vb" source=" ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/VB/getbytes_chararr.vb" id="Snippet1":::
1402
1402
1403
1403
]]> </format >
1404
1404
</remarks >
@@ -1533,9 +1533,9 @@ On .NET Core, the <xref:System.Text.Encoding.Default%2A> property always returns
1533
1533
## Examples
1534
1534
The following example determines the number of bytes required to encode a string or a range in the string, encodes the characters, and displays the resulting bytes.
1535
1535
1536
- [! code- cpp[System.Text.Encoding.GetBytes_String#1]( ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CPP/getbytes_string.cpp#1)]
1537
- [! code- csharp[System.Text.Encoding.GetBytes_String#1]( ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CS/getbytes_string.cs#1)]
1538
- [! code-vb[System.Text.Encoding.GetBytes_String#1]( ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/VB/getbytes_string.vb#1)]
1536
+ ::: code language=" cpp" source=" ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CPP/getbytes_string.cpp" id="Snippet1":::
1537
+ ::: code language=" csharp" source=" ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CS/getbytes_string.cs" interactive="try-dotnet" id="Snippet1":::
1538
+ ::: code language="vb" source=" ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/VB/getbytes_string.vb" id="Snippet1":::
1539
1539
1540
1540
]]> </format >
1541
1541
</remarks >
@@ -1711,9 +1711,9 @@ On .NET Core, the <xref:System.Text.Encoding.Default%2A> property always returns
1711
1711
## Examples
1712
1712
The following example determines the number of bytes required to encode three characters from a character array, encodes the characters, and displays the resulting bytes.
1713
1713
1714
- [! code- cpp[System.Text.Encoding.GetBytes_CharArrIC#1]( ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp#1)]
1715
- [! code- csharp[System.Text.Encoding.GetBytes_CharArrIC#1]( ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CS/getbytes_chararric.cs#1)]
1716
- [! code-vb[System.Text.Encoding.GetBytes_CharArrIC#1]( ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/VB/getbytes_chararric.vb#1)]
1714
+ ::: code language=" cpp" source=" ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp" id="Snippet1":::
1715
+ ::: code language=" csharp" source=" ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CS/getbytes_chararric.cs" interactive="try-dotnet" id="Snippet1":::
1716
+ ::: code language="vb" source=" ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/VB/getbytes_chararric.vb" id="Snippet1":::
1717
1717
1718
1718
]]> </format >
1719
1719
</remarks >
@@ -1797,9 +1797,9 @@ On .NET Core, the <xref:System.Text.Encoding.Default%2A> property always returns
1797
1797
## Examples
1798
1798
The following example determines the number of bytes required to encode three characters from a character array, encodes the characters, and displays the resulting bytes.
1799
1799
1800
- [! code- cpp[System.Text.Encoding.GetBytes_CharArrIC#1]( ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp#1)]
1801
- [! code- csharp[System.Text.Encoding.GetBytes_CharArrIC#1]( ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CS/getbytes_chararric.cs#1)]
1802
- [! code-vb[System.Text.Encoding.GetBytes_CharArrIC#1]( ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/VB/getbytes_chararric.vb#1)]
1800
+ ::: code language=" cpp" source=" ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp" id="Snippet1":::
1801
+ ::: code language=" csharp" source=" ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CS/getbytes_chararric.cs" interactive="try-dotnet" id="Snippet1":::
1802
+ ::: code language="vb" source=" ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/VB/getbytes_chararric.vb" id="Snippet1":::
1803
1803
1804
1804
]]> </format >
1805
1805
</remarks >
@@ -2604,9 +2604,9 @@ On .NET Core, the <xref:System.Text.Encoding.Default%2A> property always returns
2604
2604
## Examples
2605
2605
The following example encodes a string into an array of bytes, and then decodes the bytes into an array of characters.
2606
2606
2607
- [! code- cpp[System.Text.Encoding.GetChars#1]( ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp#1)]
2608
- [! code- csharp[System.Text.Encoding.GetChars#1]( ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CS/getchars.cs#1)]
2609
- [! code-vb[System.Text.Encoding.GetChars#1]( ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/VB/getchars.vb#1)]
2607
+ ::: code language=" cpp" source=" ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp" id="Snippet1":::
2608
+ ::: code language=" csharp" source=" ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CS/getchars.cs" interactive="try-dotnet" id="Snippet1":::
2609
+ ::: code language="vb" source=" ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/VB/getchars.vb" id="Snippet1":::
2610
2610
2611
2611
]]> </format >
2612
2612
</remarks >
@@ -2844,9 +2844,9 @@ On .NET Core, the <xref:System.Text.Encoding.Default%2A> property always returns
2844
2844
2845
2845
The following example encodes a string into an array of bytes, and then decodes a range of the bytes into an array of characters.
2846
2846
2847
- [! code- cpp[System.Text.Encoding.GetCharsIC#1]( ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CPP/getcharsic.cpp#1)]
2848
- [! code- csharp[System.Text.Encoding.GetCharsIC#1]( ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CS/getcharsic.cs#1)]
2849
- [! code-vb[System.Text.Encoding.GetCharsIC#1]( ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/VB/getcharsic.vb#1)]
2847
+ ::: code language=" cpp" source=" ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CPP/getcharsic.cpp" id="Snippet1":::
2848
+ ::: code language=" csharp" source=" ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CS/getcharsic.cs" interactive="try-dotnet" id="Snippet1":::
2849
+ ::: code language="vb" source=" ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/VB/getcharsic.vb" id="Snippet1":::
2850
2850
2851
2851
]]> </format >
2852
2852
</remarks >
@@ -4032,9 +4032,9 @@ In .NET 5.0 and later versions, the code page name `utf-7` is not supported.
4032
4032
## Examples
4033
4033
The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.
4034
4034
4035
- [! code- cpp[System.Text.Encoding.GetBytes_CharArr#1]( ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp#1)]
4036
- [! code- csharp[System.Text.Encoding.GetBytes_CharArr#1]( ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CS/getbytes_chararr.cs#1)]
4037
- [! code-vb[System.Text.Encoding.GetBytes_CharArr#1]( ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/VB/getbytes_chararr.vb#1)]
4035
+ ::: code language=" cpp" source=" ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp" id="Snippet1":::
4036
+ ::: code language=" csharp" source=" ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CS/getbytes_chararr.cs" interactive="try-dotnet" id="Snippet1":::
4037
+ ::: code language="vb" source=" ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/VB/getbytes_chararr.vb" id="Snippet1":::
4038
4038
4039
4039
]]> </format >
4040
4040
</remarks >
@@ -4117,9 +4117,9 @@ In .NET 5.0 and later versions, the code page name `utf-7` is not supported.
4117
4117
## Examples
4118
4118
The following example encodes a string into an array of bytes, and then decodes the bytes into an array of characters.
4119
4119
4120
- [! code- cpp[System.Text.Encoding.GetChars#1]( ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp#1)]
4121
- [! code- csharp[System.Text.Encoding.GetChars#1]( ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CS/getchars.cs#1)]
4122
- [! code-vb[System.Text.Encoding.GetChars#1]( ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/VB/getchars.vb#1)]
4120
+ ::: code language=" cpp" source=" ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp" id="Snippet1":::
4121
+ ::: code language=" csharp" source=" ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CS/getchars.cs" interactive="try-dotnet" id="Snippet1":::
4122
+ ::: code language="vb" source=" ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/VB/getchars.vb" id="Snippet1":::
4123
4123
4124
4124
]]> </format >
4125
4125
</remarks >
@@ -5394,9 +5394,9 @@ Starting with .NET Framework 4.6, .NET Framework includes one encoding provider,
5394
5394
## Examples
5395
5395
The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.
5396
5396
5397
- [! code- cpp[System.Text.Encoding.GetBytes_CharArr#1]( ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp#1)]
5398
- [! code- csharp[System.Text.Encoding.GetBytes_CharArr#1]( ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CS/getbytes_chararr.cs#1)]
5399
- [! code-vb[System.Text.Encoding.GetBytes_CharArr#1]( ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/VB/getbytes_chararr.vb#1)]
5397
+ ::: code language=" cpp" source=" ~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp" id="Snippet1":::
5398
+ ::: code language=" csharp" source=" ~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CS/getbytes_chararr.cs" interactive="try-dotnet" id="Snippet1":::
5399
+ ::: code language="vb" source=" ~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/VB/getbytes_chararr.vb" id="Snippet1":::
5400
5400
5401
5401
]]> </format >
5402
5402
</remarks >
0 commit comments