Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2a60d5

Browse files
jpiersonmairaw
authored andcommitted
Add new F# Console snippet references (dotnet#3664)
1 parent 91453af commit a2a60d5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

xml/System/Console.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,23 @@
8585
8686
[!code-csharp[System.Console.Class#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/unicode1.cs#1)]
8787
[!code-vb[System.Console.Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.class/vb/unicode1.vb#1)]
88+
[!code-fsharp[System.Console.Class#1](~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.console.class/fs/unicode1.fs#1)]
8889
8990
In addition to supporting code pages, the <xref:System.Console> class supports UTF-8 encoding with the <xref:System.Text.UTF8Encoding> class. Beginning with the .NET Framework 4.5, the <xref:System.Console> class also supports UTF-16 encoding with the <xref:System.Text.UnicodeEncoding> class. To display Unicode characters to the console. you set the <xref:System.Console.OutputEncoding%2A> property to either <xref:System.Text.UTF8Encoding> or <xref:System.Text.UnicodeEncoding>.
9091
9192
Support for Unicode characters requires the encoder to recognize a particular Unicode character, and also requires a font that has the glyphs needed to render that character. To successfully display Unicode characters to the console, the console font must be set to a non-raster or TrueType font such as Consolas or Lucida Console. The following example shows how you can programmatically change the font from a raster font to Lucida Console.
9293
9394
[!code-csharp[System.Console.Class.Unsafe#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class.unsafe/cs/setfont1.cs#3)]
9495
[!code-vb[System.Console.Class.Unsafe#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.class.unsafe/vb/setfont1.vb#3)]
96+
[!code-fsharp[System.Console.Class.Unsafe#3](~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.console.class.unsafe/fs/setfont1.fs#3)]
9597
9698
However, TrueType fonts can display only a subset of glyphs. For example, the Lucida Console font displays only 643 of the approximately 64,000 available characters from U+0021 to U+FB02. To see which characters a particular font supports, open the **Fonts** applet in Control Panel, choose the **Find a character** option, and choose the font whose character set you'd like to examine in the **Font** list of the **Character Map** window.
9799
98100
Windows uses font linking to display glyphs that are not available in a particular font. For information about font linking to display additional character sets, see [Globalization Step-by-Step: Fonts](https://go.microsoft.com/fwlink/?LinkId=229111). Linked fonts are defined in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink subkey of the registry. Each entry associated with this subkey corresponds to the name of a base font, and its value is a string array that defines the font files and the fonts that are linked to the base font. Each member of the array defines a linked font and takes the form *font-file-name*,*font-name*. The following example illustrates how you can programmatically define a linked font named SimSun found in a font file named simsun.ttc that displays Simplified Han characters.
99101
100102
[!code-csharp[System.Console.Class#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/fontlink1.cs#2)]
101103
[!code-vb[System.Console.Class#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.class/vb/fontlink1.vb#2)]
104+
[!code-fsharp[System.Console.Class#2](~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.console.class/fs/fontlink1.fs#2)]
102105
103106
Unicode support for the console has the following limitations:
104107
@@ -114,6 +117,7 @@
114117
115118
[!code-csharp[System.Console.Class#5](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/normalize1.cs#5)]
116119
[!code-vb[System.Console.Class#5](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.class/vb/normalize1.vb#5)]
120+
[!code-fsharp[System.Console.Class#5](~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.console.class/fs/normalize1.fs#5)]
117121
118122
Note that normalization is a viable solution only if the Unicode standard for the character includes a pre-composed form that corresponds to a particular combining character sequence.
119123
@@ -123,6 +127,7 @@
123127
124128
[!code-csharp[System.Console.Class#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/example3.cs#4)]
125129
[!code-vb[System.Console.Class#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.console.class/vb/example3.vb#4)]
130+
[!code-fsharp[System.Console.Class#4](~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.console.class/fs/example3.fs#4)]
126131
127132
<a name="Operations"></a>
128133
## Common Operations
@@ -176,6 +181,7 @@
176181
[!code-cpp[Classic Console Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Console Example/CPP/source.cpp#1)]
177182
[!code-csharp[Classic Console Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Console Example/CS/source.cs#1)]
178183
[!code-vb[Classic Console Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Console Example/VB/source.vb#1)]
184+
[!code-fsharp[Classic Console Example#1](~/samples/snippets/fsharp/VS_Snippets_CLR_Classic/classic Console Example/FS/source.fs#1)]
179185
180186
]]></format>
181187
</remarks>

0 commit comments

Comments
 (0)