|
32 | 32 | <Docs>
|
33 | 33 | <summary>Provides access to instances of the C# code generator and code compiler.</summary>
|
34 | 34 | <remarks>
|
35 |
| - <format type="text/markdown"><![CDATA[ |
36 |
| - |
37 |
| -## Remarks |
38 |
| - This class provides methods that can be used to retrieve instances of the C# <xref:System.CodeDom.Compiler.ICodeGenerator> and <xref:System.CodeDom.Compiler.ICodeCompiler> implementations. |
39 |
| - |
| 35 | + <format type="text/markdown"><![CDATA[ |
| 36 | +
|
| 37 | +## Remarks |
| 38 | +
|
| 39 | +This class provides methods that can be used to retrieve instances of the C# <xref:System.CodeDom.Compiler.ICodeGenerator> and <xref:System.CodeDom.Compiler.ICodeCompiler> implementations. |
| 40 | +
|
40 | 41 | > [!NOTE]
|
41 |
| -> This class contains a link demand and an inheritance demand at the class level that applies to all members. A <xref:System.Security.SecurityException> is thrown when either the immediate caller or the derived class does not have full-trust permission. |
42 |
| - |
43 |
| - |
44 |
| - |
45 |
| -## Examples |
46 |
| - The following example uses either the C# or Visual Basic code provider to compile a source file. The example checks the input file extension and uses the corresponding <xref:Microsoft.CSharp.CSharpCodeProvider> or <xref:Microsoft.VisualBasic.VBCodeProvider> for compilation. The input file is compiled into an executable file, and any compilation errors are displayed to the console. |
47 |
| - |
| 42 | +> This class contains a link demand and an inheritance demand at the class level that applies to all members. A <xref:System.Security.SecurityException> is thrown when either the immediate caller or the derived class does not have full-trust permission. |
| 43 | +
|
| 44 | +## Examples |
| 45 | + The following example uses either the C# or Visual Basic code provider to compile a source file. The example checks the input file extension and uses the corresponding <xref:Microsoft.CSharp.CSharpCodeProvider> or <xref:Microsoft.VisualBasic.VBCodeProvider> for compilation. The input file is compiled into an executable file, and any compilation errors are displayed to the console. |
| 46 | +
|
| 47 | +> [!IMPORTANT] |
| 48 | +> The `CompileAssemblyFrom*` methods aren't supported on .NET Core and .NET 5+. This example only runs on .NET Framework. |
| 49 | +
|
48 | 50 | :::code language="csharp" source="~/snippets/csharp/Microsoft.CSharp/CSharpCodeProvider/Overview/source.cs" id="Snippet1":::
|
49 |
| - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/CodeDom_CodeProviders/VB/source.vb" id="Snippet1"::: |
50 |
| - |
| 51 | + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/CodeDom_CodeProviders/VB/source.vb" id="Snippet1"::: |
| 52 | +
|
51 | 53 | ]]></format>
|
52 | 54 | </remarks>
|
53 | 55 | <altmember cref="T:System.CodeDom.Compiler.ICodeGenerator" />
|
|
124 | 126 | <param name="providerOptions">A <see cref="T:System.Collections.Generic.IDictionary`2" /> object that contains the provider options.</param>
|
125 | 127 | <summary>Initializes a new instance of the <see cref="T:Microsoft.CSharp.CSharpCodeProvider" /> class by using the specified provider options.</summary>
|
126 | 128 | <remarks>
|
127 |
| - <format type="text/markdown">< element in the configuration file. You can identify the version of the <xref:Microsoft.CSharp.CSharpCodeProvider> you want to use by specifying the `<providerOption>` element, supplying "CompilerVersion" as the option name, and supplying the version number (for example, "v3.5") as the option value. You must precede the version number with a lower case "v". The following configuration file example demonstrates how to specify that version 3.5 of the C# code provider should be used. |
132 |
| - |
133 |
| -```xml |
134 |
| -<configuration> |
135 |
| - <system.codedom> |
136 |
| - <compilers> |
137 |
| - <!-- zero or more compiler elements --> |
138 |
| - <compiler |
139 |
| - language="c#;cs;csharp" |
140 |
| - extension=".cs" |
141 |
| - type="Microsoft.CSharp.CSharpCodeProvider, System, |
142 |
| - Version=2.0.3600.0, Culture=neutral, |
143 |
| - PublicKeyToken=b77a5c561934e089" |
144 |
| - compilerOptions="/optimize" |
145 |
| - warningLevel="1" > |
146 |
| - <providerOption |
147 |
| - name="CompilerVersion" |
148 |
| - value="v3.5" /> |
149 |
| - </compiler> |
150 |
| - </compilers> |
151 |
| - </system.codedom> |
152 |
| -</configuration> |
153 |
| -``` |
| 133 | +In .NET Framework apps, you can obtain the value for `providerOptions` from the [\<providerOption>](/dotnet/framework/configure-apps/file-schema/compiler/provideroption-element) element in the configuration file. You can identify the version of the <xref:Microsoft.CSharp.CSharpCodeProvider> you want to use by specifying the `<providerOption>` element, supplying "CompilerVersion" as the option name, and supplying the version number (for example, "v3.5") as the option value. You must precede the version number with a lower case "v". The following configuration file example demonstrates how to specify that version 3.5 of the C# code provider should be used. |
| 134 | +
|
| 135 | +```xml |
| 136 | +<configuration> |
| 137 | + <system.codedom> |
| 138 | + <compilers> |
| 139 | + <!-- zero or more compiler elements --> |
| 140 | + <compiler |
| 141 | + language="c#;cs;csharp" |
| 142 | + extension=".cs" |
| 143 | + type="Microsoft.CSharp.CSharpCodeProvider, System, |
| 144 | + Version=2.0.3600.0, Culture=neutral, |
| 145 | + PublicKeyToken=b77a5c561934e089" |
| 146 | + compilerOptions="/optimize" |
| 147 | + warningLevel="1" > |
| 148 | + <providerOption |
| 149 | + name="CompilerVersion" |
| 150 | + value="v3.5" /> |
| 151 | + </compiler> |
| 152 | + </compilers> |
| 153 | + </system.codedom> |
| 154 | +</configuration> |
| 155 | +``` |
154 | 156 |
|
155 | 157 | ## Examples
|
156 | 158 |
|
157 |
| - The following example shows how to specify the compiler version when you create a new instance of the <xref:Microsoft.CSharp.CSharpCodeProvider> class. |
158 |
| - |
159 |
| - :::code language="csharp" source="~/snippets/csharp/Microsoft.CSharp/CSharpCodeProvider/.ctor/program.cs" id="Snippet1"::: |
160 |
| - |
| 159 | + The following example shows how to specify the compiler version when you create a new instance of the <xref:Microsoft.CSharp.CSharpCodeProvider> class. |
| 160 | +
|
| 161 | + :::code language="csharp" source="~/snippets/csharp/Microsoft.CSharp/CSharpCodeProvider/.ctor/program.cs" id="Snippet1"::: |
| 162 | +
|
161 | 163 | ]]></format>
|
162 | 164 | </remarks>
|
163 | 165 | <exception cref="T:System.ArgumentNullException">
|
@@ -291,11 +293,11 @@ In .NET Framework apps, you can obtain the value for `providerOptions` from the
|
291 | 293 | <summary>Gets the file name extension to use when creating source code files.</summary>
|
292 | 294 | <value>The file name extension to use for generated source code files.</value>
|
293 | 295 | <remarks>
|
294 |
| - <format type="text/markdown"><![CDATA[ |
295 |
| - |
296 |
| -## Remarks |
297 |
| - This file name extension is usually the extension used by the language's source code files. |
298 |
| - |
| 296 | + <format type="text/markdown"><![CDATA[ |
| 297 | +
|
| 298 | +## Remarks |
| 299 | + This file name extension is usually the extension used by the language's source code files. |
| 300 | +
|
299 | 301 | ]]></format>
|
300 | 302 | </remarks>
|
301 | 303 | </Docs>
|
@@ -337,19 +339,19 @@ In .NET Framework apps, you can obtain the value for `providerOptions` from the
|
337 | 339 | <param name="options">The <see cref="T:System.CodeDom.Compiler.CodeGeneratorOptions" /> to use when generating the code.</param>
|
338 | 340 | <summary>Generates code for the specified class member using the specified text writer and code generator options.</summary>
|
339 | 341 | <remarks>
|
340 |
| - <format type="text/markdown"><![CDATA[ |
341 |
| - |
342 |
| -## Remarks |
343 |
| - Members are generated differently depending on their context. For example, a method in an interface or a field in an enumeration is generated differently than a method or field on a class. This implementation generates code for a member in the class context. |
344 |
| - |
345 |
| - |
346 |
| - |
347 |
| -## Examples |
348 |
| - The following code example shows the use of the <xref:Microsoft.CSharp.CSharpCodeProvider.GenerateCodeFromMember%2A> method to create a code fragment to be used in a CodeDOM graph. This code example is part of a larger example provided for the <xref:System.CodeDom.Compiler.CodeDomProvider.GenerateCodeFromMember%2A> method of the <xref:System.CodeDom.Compiler.CodeDomProvider> class. |
349 |
| - |
| 342 | + <format type="text/markdown"><![CDATA[ |
| 343 | +
|
| 344 | +## Remarks |
| 345 | + Members are generated differently depending on their context. For example, a method in an interface or a field in an enumeration is generated differently than a method or field on a class. This implementation generates code for a member in the class context. |
| 346 | +
|
| 347 | +
|
| 348 | +
|
| 349 | +## Examples |
| 350 | + The following code example shows the use of the <xref:Microsoft.CSharp.CSharpCodeProvider.GenerateCodeFromMember%2A> method to create a code fragment to be used in a CodeDOM graph. This code example is part of a larger example provided for the <xref:System.CodeDom.Compiler.CodeDomProvider.GenerateCodeFromMember%2A> method of the <xref:System.CodeDom.Compiler.CodeDomProvider> class. |
| 351 | +
|
350 | 352 | :::code language="csharp" source="~/snippets/csharp/Microsoft.CSharp/CSharpCodeProvider/GenerateCodeFromMember/program.cs" id="Snippet3":::
|
351 |
| - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/CodeDom_GenerateCodeFromMember/vb/module1.vb" id="Snippet3"::: |
352 |
| - |
| 353 | + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/CodeDom_GenerateCodeFromMember/vb/module1.vb" id="Snippet3"::: |
| 354 | +
|
353 | 355 | ]]></format>
|
354 | 356 | </remarks>
|
355 | 357 | <altmember cref="T:System.CodeDom.CodeTypeMember" />
|
@@ -392,11 +394,11 @@ In .NET Framework apps, you can obtain the value for `providerOptions` from the
|
392 | 394 | <summary>Gets a <see cref="T:System.ComponentModel.TypeConverter" /> for the specified type of object.</summary>
|
393 | 395 | <returns>A <see cref="T:System.ComponentModel.TypeConverter" /> for the specified type.</returns>
|
394 | 396 | <remarks>
|
395 |
| - <format type="text/markdown"><![CDATA[ |
396 |
| - |
397 |
| -## Remarks |
398 |
| - A derived class can override this method to provide specific types of type converters for specific data types. |
399 |
| - |
| 397 | + <format type="text/markdown"><![CDATA[ |
| 398 | +
|
| 399 | +## Remarks |
| 400 | + A derived class can override this method to provide specific types of type converters for specific data types. |
| 401 | +
|
400 | 402 | ]]></format>
|
401 | 403 | </remarks>
|
402 | 404 | </Docs>
|
|
0 commit comments