|
81 | 81 | ## Examples
|
82 | 82 | The following example demonstrates how to encode Unicode characters into ASCII. Notice the loss of data that occurs when your application uses <xref:System.Text.ASCIIEncoding> to encode Unicode characters outside of the ASCII range.
|
83 | 83 |
|
84 |
| - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/CPP/snippet.cpp" id="Snippet1"::: |
85 | 84 | :::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/Overview/snippet.cs" interactive="try-dotnet" id="Snippet1":::
|
86 | 85 | :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/VB/snippet.vb" id="Snippet1":::
|
87 | 86 |
|
|
145 | 144 | ## Examples
|
146 | 145 | The following example demonstrates how to create a new <xref:System.Text.ASCIIEncoding> instance and display the name of the encoding.
|
147 | 146 |
|
148 |
| - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/CPP/ctor.cpp" id="Snippet1"::: |
149 | 147 | :::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/.ctor/ctor.cs" id="Snippet1":::
|
150 | 148 | :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/VB/ctor.vb" id="Snippet1":::
|
151 | 149 |
|
|
268 | 266 | ## Examples
|
269 | 267 | The following example demonstrates how to use the <xref:System.Text.ASCIIEncoding.GetByteCount%2A> method to return the number of bytes required to encode a string using <xref:System.Text.ASCIIEncoding>.
|
270 | 268 |
|
271 |
| - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/CPP/getbytecount-string.cpp" id="Snippet1"::: |
272 | 269 | :::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetByteCount/getbytecount-string.cs" id="Snippet1":::
|
273 | 270 | :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/VB/getbytecount-string.vb" id="Snippet1":::
|
274 | 271 |
|
|
436 | 433 | ## Examples
|
437 | 434 | The following example demonstrates how to use the <xref:System.Text.ASCIIEncoding.GetByteCount%2A> method to return the number of bytes required to encode an array of Unicode characters using <xref:System.Text.ASCIIEncoding>.
|
438 | 435 |
|
439 |
| - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/CPP/getbytecount-char[]-int32-int32.cpp" id="Snippet1"::: |
440 | 436 | :::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetByteCount/getbytecount-char[]-int32-int32.cs" id="Snippet1":::
|
441 | 437 | :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/VB/getbytecount-char[]-int32-int32.vb" id="Snippet1":::
|
442 | 438 |
|
|
700 | 696 | ## Examples
|
701 | 697 | The following example demonstrates how to use the <xref:System.Text.ASCIIEncoding.GetBytes%2A> method to encode a range of characters from a string and store the encoded characters in a range of elements in a byte array.
|
702 | 698 |
|
703 |
| - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp" id="Snippet1"::: |
704 | 699 | :::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetBytes/getbytes-string-int32-int32-byte[]-int32.cs" interactive="try-dotnet" id="Snippet1":::
|
705 | 700 | :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/VB/getbytes-string-int32-int32-byte[]-int32.vb" id="Snippet1":::
|
706 | 701 |
|
|
807 | 802 | ## Examples
|
808 | 803 | The following example demonstrates how to use the <xref:System.Text.ASCIIEncoding.GetBytes%2A> method to encode a range of elements from a Unicode character array and store the encoded bytes in a range of elements in a byte array.
|
809 | 804 |
|
810 |
| - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp" id="Snippet1"::: |
811 | 805 | :::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetBytes/getbytes-char[]-int32-int32-byte[]-int32.cs" interactive="try-dotnet" id="Snippet1":::
|
812 | 806 | :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/VB/getbytes-char[]-int32-int32-byte[]-int32.vb" id="Snippet1":::
|
813 | 807 |
|
|
1040 | 1034 | ## Examples
|
1041 | 1035 | The following example demonstrates how to use the <xref:System.Text.ASCIIEncoding.GetCharCount%2A> method to return the number of characters produced by decoding a range of elements in a byte array.
|
1042 | 1036 |
|
1043 |
| - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp" id="Snippet1"::: |
1044 | 1037 | :::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetCharCount/getcharcount-byte[]-int32-int32.cs" id="Snippet1":::
|
1045 | 1038 | :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/VB/getcharcount-byte[]-int32-int32.vb" id="Snippet1":::
|
1046 | 1039 |
|
|
1305 | 1298 | ## Examples
|
1306 | 1299 | The following example demonstrates how to decode a range of elements from a byte array and store the result in a set of elements in a Unicode character array.
|
1307 | 1300 |
|
1308 |
| - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp" id="Snippet1"::: |
1309 | 1301 | :::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetChars/getchars-byte[]-int32-int32-char[]-int32.cs" id="Snippet1":::
|
1310 | 1302 | :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/VB/getchars-byte[]-int32-int32-char[]-int32.vb" id="Snippet1":::
|
1311 | 1303 |
|
|
1524 | 1516 | ## Examples
|
1525 | 1517 | The following example demonstrates how to use the <xref:System.Text.ASCIIEncoding.GetMaxByteCount%2A> method to calculate the bytes required to encode a specified number of characters.
|
1526 | 1518 |
|
1527 |
| - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp" id="Snippet1"::: |
1528 | 1519 | :::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetMaxByteCount/getmaxbytecount-int32.cs" id="Snippet1":::
|
1529 | 1520 | :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/VB/getmaxbytecount-int32.vb" id="Snippet1":::
|
1530 | 1521 |
|
|
1602 | 1593 | ## Examples
|
1603 | 1594 | The following example demonstrates how to use the <xref:System.Text.ASCIIEncoding.GetMaxCharCount%2A> method to calculate the maximum number of characters needed to decode a specified number of bytes.
|
1604 | 1595 |
|
1605 |
| - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp" id="Snippet1"::: |
1606 | 1596 | :::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetMaxCharCount/getmaxcharcount-int32.cs" id="Snippet1":::
|
1607 | 1597 | :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/VB/getmaxcharcount-int32.vb" id="Snippet1":::
|
1608 | 1598 |
|
|
1718 | 1708 | ## Examples
|
1719 | 1709 | The following example demonstrates how to use the <xref:System.Text.ASCIIEncoding.GetString%2A> method to convert a byte array into a <xref:System.String>.
|
1720 | 1710 |
|
1721 |
| - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/CPP/getstring-byte[].cpp" id="Snippet1"::: |
1722 | 1711 | :::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetString/getstring-byte[].cs" interactive="try-dotnet" id="Snippet1":::
|
1723 | 1712 | :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/VB/getstring-byte[].vb" id="Snippet1":::
|
1724 | 1713 |
|
|
0 commit comments