Skip to content
Draft
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
5 changes: 0 additions & 5 deletions includes/csharp-interactive-with-utc-note.md

This file was deleted.

2 changes: 1 addition & 1 deletion xml/System/Action`1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
## Examples
The following example demonstrates the use of the <xref:System.Action%601> delegate to print the contents of a <xref:System.Collections.Generic.List%601> object. In this example, the `Print` method is used to display the contents of the list to the console. In addition, the C# example also demonstrates the use of anonymous methods to display the contents to the console. Note that the example does not explicitly declare an <xref:System.Action%601> variable. Instead, it passes a reference to a method that takes a single parameter and that does not return a value to the <xref:System.Collections.Generic.List%601.ForEach%2A?displayProperty=nameWithType> method, whose single parameter is an <xref:System.Action%601> delegate. Similarly, in the C# example, an <xref:System.Action%601> delegate is not explicitly instantiated because the signature of the anonymous method matches the signature of the <xref:System.Action%601> delegate that is expected by the <xref:System.Collections.Generic.List%601.ForEach%2A?displayProperty=nameWithType> method.

:::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/action.cs" interactive="try-dotnet-method" id="Snippet01":::
:::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/action.cs" id="Snippet01":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action_PrintExample/fs/action.fs" id="Snippet01":::
:::code language="vb" source="~/snippets/visualbasic/System/ActionT/Overview/action.vb" id="Snippet01":::

Expand Down
8 changes: 4 additions & 4 deletions xml/System/Action`2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,23 @@

When you use the <xref:System.Action%602> delegate, you do not have to explicitly define a delegate that encapsulates a method with two parameters. For example, the following code explicitly declares a delegate named `ConcatStrings`. It then assigns a reference to either of two methods to its delegate instance. One method writes two strings to the console; the second writes two strings to a file.

:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2/Overview/Delegate.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2/Overview/Delegate.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action~2/fs/Delegate.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System/ActionT1,T2/Overview/Delegate.vb" id="Snippet1":::

The following example simplifies this code by instantiating the <xref:System.Action%602> delegate instead of explicitly defining a new delegate and assigning a named method to it.

:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2/Overview/Action2.cs" interactive="try-dotnet" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2/Overview/Action2.cs" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action~2/fs/Action2.fs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/System/ActionT1,T2/Overview/action2.vb" id="Snippet2":::

You can also use the <xref:System.Action%602> delegate with anonymous methods in C#, as the following example illustrates. (For an introduction to anonymous methods, see [Anonymous Methods](/dotnet/csharp/programming-guide/statements-expressions-operators/anonymous-methods).)

:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2/Overview/Anon.cs" interactive="try-dotnet" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2/Overview/Anon.cs" id="Snippet3":::

You can also assign a lambda expression to an <xref:System.Action%602> delegate instance, as the following example illustrates. (For an introduction to lambda expressions, see [Lambda Expressions (C#)](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions), or [Lambda Expressions (F#)](/dotnet/fsharp/language-reference/functions/lambda-expressions-the-fun-keyword).)

:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2/Overview/Lambda.cs" interactive="try-dotnet" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2/Overview/Lambda.cs" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action~2/fs/Lambda.fs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/System/ActionT1,T2/Overview/lambda.vb" id="Snippet4":::

Expand Down
8 changes: 4 additions & 4 deletions xml/System/Action`3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,23 @@

When you use the <xref:System.Action%603> delegate, you don't have to explicitly define a delegate that encapsulates a method with three parameters. For example, the following code explicitly declares a delegate named `StringCopy` and assigns a reference to the `CopyStrings` method to its delegate instance.

:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2,T3/Overview/Delegate.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2,T3/Overview/Delegate.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Delegate.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System/ActionT1,T2,T3/Overview/Delegate.vb" id="Snippet1":::

The following example simplifies this code by instantiating the <xref:System.Action%603> delegate instead of explicitly defining a new delegate and assigning a named method to it.

:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2,T3/Overview/Action3.cs" interactive="try-dotnet" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2,T3/Overview/Action3.cs" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Action3.fs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/System/ActionT1,T2,T3/Overview/Action3.vb" id="Snippet2":::

You can also use the <xref:System.Action%603> delegate with anonymous methods in C#, as the following example illustrates. (For an introduction to anonymous methods, see [Anonymous Methods](/dotnet/csharp/programming-guide/statements-expressions-operators/anonymous-methods).)

:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2,T3/Overview/Anon.cs" interactive="try-dotnet" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2,T3/Overview/Anon.cs" id="Snippet3":::

You can also assign a lambda expression to an <xref:System.Action%603> delegate instance, as the following example illustrates. (For an introduction to lambda expressions, see [Lambda Expressions (C#)](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions) or [Lambda Expressions (F#)](/dotnet/fsharp/language-reference/functions/lambda-expressions-the-fun-keyword).)

:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2,T3/Overview/Lambda.cs" interactive="try-dotnet" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System/ActionT1,T2,T3/Overview/Lambda.cs" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Lambda.fs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/System/ActionT1,T2,T3/Overview/lambda.vb" id="Snippet4":::

Expand Down
6 changes: 3 additions & 3 deletions xml/System/Activator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@
## Examples
The following code example demonstrates how to call the <xref:System.Activator.CreateInstance%28System.Type%29> method. Instances of several different types are created and their default values are displayed.

:::code language="csharp" source="~/snippets/csharp/System/Activator/Overview/source2.cs" interactive="try-dotnet" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System/Activator/Overview/source2.cs" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/ActivatorX/fs/source2.fs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/System/Activator/Overview/source2.vb" id="Snippet4":::

Expand Down Expand Up @@ -815,13 +815,13 @@ Note: In <see href="https://go.microsoft.com/fwlink/?LinkID=247912">.NET for Win
## Examples
The following example calls the <xref:System.Activator.CreateInstance%28System.Type%2CSystem.Object%5B%5D%29> method to create a <xref:System.String> object. It calls the <xref:System.String.%23ctor%28System.Char%5B%5D%2CSystem.Int32%2CSystem.Int32%29?displayProperty=nameWithType> constructor to instantiate a string that contains ten elements from a character array starting at the fourteenth position.

:::code language="csharp" source="~/snippets/csharp/System/Activator/CreateInstance/CreateInstance5.cs" interactive="try-dotnet" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System/Activator/CreateInstance/CreateInstance5.cs" id="Snippet5":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.activator.createinstance/fs/CreateInstance5.fs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/System/Activator/CreateInstance/CreateInstance5.vb" id="Snippet5":::

The following example creates a jagged array whose elements are arguments to be passed to a <xref:System.String> constructor. The example then passes each array to the <xref:System.Activator.CreateInstance%28System.Type%2CSystem.Object%5B%5D%29> method to invoke the appropriate string constructor.

:::code language="csharp" source="~/snippets/csharp/System/Activator/CreateInstance/createinstance2.cs" interactive="try-dotnet" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System/Activator/CreateInstance/createinstance2.cs" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.activator.createinstance/fs/createinstance2.fs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/System/Activator/CreateInstance/createinstance2.vb" id="Snippet4":::

Expand Down
2 changes: 1 addition & 1 deletion xml/System/AppDomain.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7839,7 +7839,7 @@ The friendly name of the default application domain is the file name of the proc
The following example demonstrates how to use the <xref:System.AppDomain.SetData%28System.String%2CSystem.Object%29> method to create a new value pair. The example then uses the <xref:System.AppDomain.GetData%2A> method to retrieve the value, and displays it to the console.

:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ADGetData/CPP/adgetdata.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/AppDomain/GetData/adgetdata.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/AppDomain/GetData/adgetdata.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/GetData/adgetdata.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System/AppDomain/GetData/adgetdata.vb" id="Snippet1":::

Expand Down
2 changes: 1 addition & 1 deletion xml/System/ArgumentException.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ In F#, you can use the [invalidArg](/dotnet/fsharp/language-reference/exception-

The following example demonstrates how to throw and catch an <xref:System.ArgumentException>. It uses the [ArgumentException.GetType().Name](xref:System.Type.Name%2A) property to display the name of the exception object, and also uses the <xref:System.ArgumentException.Message%2A> property to display the text of the exception message.

:::code language="csharp" source="~/snippets/csharp/System/ArgumentException/Overview/argumentexception2.cs" interactive="try-dotnet" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System/ArgumentException/Overview/argumentexception2.cs" id="Snippet3":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/ArgumentException/FS/argumentexception2.fs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/System/ArgumentException/Overview/program2.vb" id="Snippet3":::

Expand Down
12 changes: 6 additions & 6 deletions xml/System/ArgumentOutOfRangeException.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ The conditions in which an <xref:System.ArgumentOutOfRangeException> exception i

1. The collection has no members, and your code assumes that it does. The following example attempts to retrieve the first element of a collection that has no elements:

:::code language="csharp" source="~/snippets/csharp/System/ArgumentOutOfRangeException/Overview/NoElements.cs" interactive="try-dotnet" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System/ArgumentOutOfRangeException/Overview/NoElements.cs" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/NoElements.fs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/System/ArgumentOutOfRangeException/Overview/NoElements.vb" id="Snippet4":::

Expand All @@ -118,7 +118,7 @@ The conditions in which an <xref:System.ArgumentOutOfRangeException> exception i

3. You're attempting to retrieve an item whose index is negative. This usually occurs because you've searched a collection for the index of a particular element and have erroneously assumed that the search is successful. In the following example, the call to the <xref:System.Collections.Generic.List%601.FindIndex%28System.Predicate%7B%600%7D%29?displayProperty=nameWithType> method fails to find a string equal to "Z" and so returns -1. However, this is an invalid index value.

:::code language="csharp" source="~/snippets/csharp/System/ArgumentOutOfRangeException/Overview/BadSearch.cs" interactive="try-dotnet" id="Snippet6":::
:::code language="csharp" source="~/snippets/csharp/System/ArgumentOutOfRangeException/Overview/BadSearch.cs" id="Snippet6":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/BadSearch.fs" id="Snippet6":::
:::code language="vb" source="~/snippets/visualbasic/System/ArgumentOutOfRangeException/Overview/BadSearch.vb" id="Snippet6":::

Expand All @@ -130,7 +130,7 @@ The conditions in which an <xref:System.ArgumentOutOfRangeException> exception i

4. You're attempting to retrieve an element whose index is equal to the value of the collection's `Count` property, as the following example illustrates.

:::code language="csharp" source="~/snippets/csharp/System/ArgumentOutOfRangeException/Overview/OOR2.cs" interactive="try-dotnet" id="Snippet8":::
:::code language="csharp" source="~/snippets/csharp/System/ArgumentOutOfRangeException/Overview/OOR2.cs" id="Snippet8":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/OOR2.fs" id="Snippet8":::
:::code language="vb" source="~/snippets/visualbasic/System/ArgumentOutOfRangeException/Overview/OOR2.vb" id="Snippet8":::

Expand Down Expand Up @@ -168,7 +168,7 @@ The conditions in which an <xref:System.ArgumentOutOfRangeException> exception i

To eliminate the exception, validate the value returned by the string search method before calling the string manipulation method.

:::code language="csharp" source="~/snippets/csharp/System/ArgumentOutOfRangeException/Overview/NoFind2.cs" interactive="try-dotnet" id="Snippet18":::
:::code language="csharp" source="~/snippets/csharp/System/ArgumentOutOfRangeException/Overview/NoFind2.cs" id="Snippet18":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/NoFind2.fs" id="Snippet18":::
:::code language="vb" source="~/snippets/visualbasic/System/ArgumentOutOfRangeException/Overview/NoFind2.vb" id="Snippet18":::

Expand All @@ -192,7 +192,7 @@ The conditions in which an <xref:System.ArgumentOutOfRangeException> exception i

The following example defines a `FindWords` method that uses the <xref:System.String.IndexOfAny%28System.Char%5B%5D%2CSystem.Int32%29?displayProperty=nameWithType> method to identify space characters and punctuation marks in a string and returns an array that contains the words found in the string.

:::code language="csharp" source="~/snippets/csharp/System/ArgumentOutOfRangeException/Overview/FindWords1.cs" interactive="try-dotnet" id="Snippet19":::
:::code language="csharp" source="~/snippets/csharp/System/ArgumentOutOfRangeException/Overview/FindWords1.cs" id="Snippet19":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/FindWords1.fs" id="Snippet19":::
:::code language="vb" source="~/snippets/visualbasic/System/ArgumentOutOfRangeException/Overview/FindWords1.vb" id="Snippet19":::

Expand Down Expand Up @@ -250,7 +250,7 @@ For a list of initial property values for an instance of <xref:System.ArgumentOu

The following example defines a class to contain information about an invited guest. If the guest is younger than 21, an <xref:System.ArgumentOutOfRangeException> exception is thrown.

:::code language="csharp" source="~/snippets/csharp/System/ArgumentOutOfRangeException/Overview/program.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/ArgumentOutOfRangeException/Overview/program.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/ArgumentOutOfRangeException/FS/program.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System/ArgumentOutOfRangeException/Overview/program.vb" id="Snippet1":::

Expand Down
Loading