Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// <Snippet1>
// <Snippet3>
using System;
using System.ComponentModel;
using System.IO;
Expand Down Expand Up @@ -49,14 +48,13 @@ static void Main()
startInfo.Verb = verbToUse;
if (verbToUse.ToLower().IndexOf("printto") >= 0)
{
// printto implies a specific printer. Ask for the network address.
// printto implies a specific printer. Ask for the network address.
// The address must be in the form \\server\printer.
// The printer address is passed as the Arguments property.
Console.Write("Enter the network address of the target printer: ");
var arguments = Console.ReadLine();
startInfo.Arguments = arguments;
}
// </Snippet4>

try
{
Expand All @@ -81,6 +79,7 @@ static void Main()
Console.WriteLine($"Unable to start '{fileName}' with verb {verbToUse}");
}
}
// </Snippet4>
}
else
{
Expand All @@ -90,5 +89,4 @@ static void Main()
}
}
}
// </Snippet3>
// </Snippet1>
134 changes: 68 additions & 66 deletions xml/Microsoft.CSharp/CSharpCodeProvider.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,24 @@
<Docs>
<summary>Provides access to instances of the C# code generator and code compiler.</summary>
<remarks>
<format type="text/markdown"><![CDATA[

## Remarks
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.

<format type="text/markdown"><![CDATA[

## Remarks

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.

> [!NOTE]
> 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.



## Examples
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.

> 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.

## Examples
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.

> [!IMPORTANT]
> The `CompileAssemblyFrom*` methods aren't supported on .NET Core and .NET 5+. This example only runs on .NET Framework.

:::code language="csharp" source="~/snippets/csharp/Microsoft.CSharp/CSharpCodeProvider/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/CodeDom_CodeProviders/VB/source.vb" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/CodeDom_CodeProviders/VB/source.vb" id="Snippet1":::

]]></format>
</remarks>
<altmember cref="T:System.CodeDom.Compiler.ICodeGenerator" />
Expand Down Expand Up @@ -124,40 +126,40 @@
<param name="providerOptions">A <see cref="T:System.Collections.Generic.IDictionary`2" /> object that contains the provider options.</param>
<summary>Initializes a new instance of the <see cref="T:Microsoft.CSharp.CSharpCodeProvider" /> class by using the specified provider options.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<format type="text/markdown"><![CDATA[

## Remarks

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.
```xml
<configuration>
<system.codedom>
<compilers>
<!-- zero or more compiler elements -->
<compiler
language="c#;cs;csharp"
extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider, System,
Version=2.0.3600.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
compilerOptions="/optimize"
warningLevel="1" >
<providerOption
name="CompilerVersion"
value="v3.5" />
</compiler>
</compilers>
</system.codedom>
</configuration>
```
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.

```xml
<configuration>
<system.codedom>
<compilers>
<!-- zero or more compiler elements -->
<compiler
language="c#;cs;csharp"
extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider, System,
Version=2.0.3600.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
compilerOptions="/optimize"
warningLevel="1" >
<providerOption
name="CompilerVersion"
value="v3.5" />
</compiler>
</compilers>
</system.codedom>
</configuration>
```

## Examples

The following example shows how to specify the compiler version when you create a new instance of the <xref:Microsoft.CSharp.CSharpCodeProvider> class.
:::code language="csharp" source="~/snippets/csharp/Microsoft.CSharp/CSharpCodeProvider/.ctor/program.cs" id="Snippet1":::
The following example shows how to specify the compiler version when you create a new instance of the <xref:Microsoft.CSharp.CSharpCodeProvider> class.

:::code language="csharp" source="~/snippets/csharp/Microsoft.CSharp/CSharpCodeProvider/.ctor/program.cs" id="Snippet1":::

]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
Expand Down Expand Up @@ -291,11 +293,11 @@ In .NET Framework apps, you can obtain the value for `providerOptions` from the
<summary>Gets the file name extension to use when creating source code files.</summary>
<value>The file name extension to use for generated source code files.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This file name extension is usually the extension used by the language's source code files.
<format type="text/markdown"><![CDATA[

## Remarks
This file name extension is usually the extension used by the language's source code files.

]]></format>
</remarks>
</Docs>
Expand Down Expand Up @@ -337,19 +339,19 @@ In .NET Framework apps, you can obtain the value for `providerOptions` from the
<param name="options">The <see cref="T:System.CodeDom.Compiler.CodeGeneratorOptions" /> to use when generating the code.</param>
<summary>Generates code for the specified class member using the specified text writer and code generator options.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
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.
## Examples
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.
<format type="text/markdown"><![CDATA[

## Remarks
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.



## Examples
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.

:::code language="csharp" source="~/snippets/csharp/Microsoft.CSharp/CSharpCodeProvider/GenerateCodeFromMember/program.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/CodeDom_GenerateCodeFromMember/vb/module1.vb" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/CodeDom_GenerateCodeFromMember/vb/module1.vb" id="Snippet3":::

]]></format>
</remarks>
<altmember cref="T:System.CodeDom.CodeTypeMember" />
Expand Down Expand Up @@ -392,11 +394,11 @@ In .NET Framework apps, you can obtain the value for `providerOptions` from the
<summary>Gets a <see cref="T:System.ComponentModel.TypeConverter" /> for the specified type of object.</summary>
<returns>A <see cref="T:System.ComponentModel.TypeConverter" /> for the specified type.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A derived class can override this method to provide specific types of type converters for specific data types.
<format type="text/markdown"><![CDATA[

## Remarks
A derived class can override this method to provide specific types of type converters for specific data types.

]]></format>
</remarks>
</Docs>
Expand Down
18 changes: 9 additions & 9 deletions xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@
<summary>Gets or sets the maximum size of the cache.</summary>
<value>To be added.</value>
<remarks>
<format type="text/markdown"><![CDATA[
> [!CAUTION]
> There may be transient states while the cache is full but blocks are being released on a background thread. In this state, unexpected behavior might occur if the cache is being overutilized.
<format type="text/markdown"><![CDATA[
> [!CAUTION]
> There might be transient states while the cache is full but blocks are being released on a background thread. In this state, unexpected behavior might occur if the cache is being overutilized.
]]></format>
</remarks>
</Docs>
Expand All @@ -238,12 +238,12 @@
<value>
<see langword="true" /> if linked entries are tracked; otherwise, <see langword="false" />. The default is <see langword="false" /> in .NET 7 and later versions.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Prior to .NET 7 this feature was always enabled.
<format type="text/markdown"><![CDATA[

## Remarks

Prior to .NET 7 this feature was always enabled.

]]></format>
</remarks>
</Docs>
Expand Down
Loading