Skip to content

Commit 62fd8aa

Browse files
committed
reset a few changes we're not ready for
1 parent 77bdd10 commit 62fd8aa

File tree

4 files changed

+103
-95
lines changed

4 files changed

+103
-95
lines changed

xml/System/Action.xml

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,36 +63,38 @@
6363
<Docs>
6464
<summary>Encapsulates a method that has no parameters and does not return a value.</summary>
6565
<remarks>
66-
<format type="text/markdown"><![CDATA[
67-
68-
## Remarks
69-
You can use this delegate to pass a method as a parameter without explicitly declaring a custom delegate. The encapsulated method must correspond to the method signature that is defined by this delegate. This means that the encapsulated method must have no parameters and no return value. (In C#, the method must return `void`. In F# the function or method must return `unit`. In Visual Basic, it must be defined by the `Sub`…`End Sub` construct. It can also be a method that returns a value that is ignored.) Typically, such a method is used to perform an operation.
70-
66+
<format type="text/markdown"><![CDATA[
67+
68+
## Remarks
69+
You can use this delegate to pass a method as a parameter without explicitly declaring a custom delegate. The encapsulated method must correspond to the method signature that is defined by this delegate. This means that the encapsulated method must have no parameters and no return value. (In C#, the method must return `void`. In F# the function or method must return `unit`. In Visual Basic, it must be defined by the `Sub`…`End Sub` construct. It can also be a method that returns a value that is ignored.) Typically, such a method is used to perform an operation.
70+
7171
> [!NOTE]
72-
> To reference a method that has no parameters and returns a value, use the generic <xref:System.Func%601> delegate instead.
73-
74-
When you use the <xref:System.Action> delegate, you do not have to explicitly define a delegate that encapsulates a parameterless procedure. For example, the following code explicitly declares a delegate named `ShowValue` and assigns a reference to the `Name.DisplayToWindow` instance method to its delegate instance.
75-
72+
> To reference a method that has no parameters and returns a value, use the generic <xref:System.Func%601> delegate instead.
73+
74+
When you use the <xref:System.Action> delegate, you do not have to explicitly define a delegate that encapsulates a parameterless procedure. For example, the following code explicitly declares a delegate named `ShowValue` and assigns a reference to the `Name.DisplayToWindow` instance method to its delegate instance.
75+
76+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp" id="Snippet1":::
7677
:::code language="csharp" source="~/snippets/csharp/System/Action/Overview/delegate1.cs" id="Snippet1":::
7778
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action/fs/Delegate.fs" id="Snippet1":::
78-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.action.delegate/vb/delegate.vb" id="Snippet1":::
79-
80-
The following example simplifies this code by instantiating the <xref:System.Action> delegate instead of explicitly defining a new delegate and assigning a named method to it.
81-
79+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.action.delegate/vb/delegate.vb" id="Snippet1":::
80+
81+
The following example simplifies this code by instantiating the <xref:System.Action> delegate instead of explicitly defining a new delegate and assigning a named method to it.
82+
83+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp" id="Snippet2":::
8284
:::code language="csharp" source="~/snippets/csharp/System/Action/Overview/Action.cs" id="Snippet2":::
8385
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action/fs/Action.fs" id="Snippet2":::
84-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action/vb/Action.vb" id="Snippet2":::
85-
86-
You can also use the <xref:System.Action> 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).)
87-
88-
:::code language="csharp" source="~/snippets/csharp/System/Action/Overview/Anon.cs" id="Snippet3":::
89-
90-
You can also assign a lambda expression to an <xref:System.Action> 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).)
91-
86+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action/vb/Action.vb" id="Snippet2":::
87+
88+
You can also use the <xref:System.Action> 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).)
89+
90+
:::code language="csharp" source="~/snippets/csharp/System/Action/Overview/Anon.cs" id="Snippet3":::
91+
92+
You can also assign a lambda expression to an <xref:System.Action> 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).)
93+
9294
:::code language="csharp" source="~/snippets/csharp/System/Action/Overview/Lambda.cs" id="Snippet4":::
9395
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action/fs/Lambda.fs" id="Snippet4":::
94-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action/vb/lambda.vb" id="Snippet4":::
95-
96+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action/vb/lambda.vb" id="Snippet4":::
97+
9698
]]></format>
9799
</remarks>
98100
<altmember cref="T:System.Func`1" />

xml/System/Action`1.xml

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -73,47 +73,49 @@
7373
<param name="obj">The parameter of the method that this delegate encapsulates.</param>
7474
<summary>Encapsulates a method that has a single parameter and does not return a value.</summary>
7575
<remarks>
76-
<format type="text/markdown"><![CDATA[
77-
78-
## Remarks
79-
You can use the <xref:System.Action%601> delegate to pass a method as a parameter without explicitly declaring a custom delegate. The encapsulated method must correspond to the method signature that is defined by this delegate. This means that the encapsulated method must have one parameter that is passed to it by value, and it must not return a value. (In C#, the method must return `void`. In Visual Basic, it must be defined by the `Sub`…`End Sub` construct. It can also be a method that returns a value that is ignored.) Typically, such a method is used to perform an operation.
80-
76+
<format type="text/markdown"><![CDATA[
77+
78+
## Remarks
79+
You can use the <xref:System.Action%601> delegate to pass a method as a parameter without explicitly declaring a custom delegate. The encapsulated method must correspond to the method signature that is defined by this delegate. This means that the encapsulated method must have one parameter that is passed to it by value, and it must not return a value. (In C#, the method must return `void`. In Visual Basic, it must be defined by the `Sub`…`End Sub` construct. It can also be a method that returns a value that is ignored.) Typically, such a method is used to perform an operation.
80+
8181
> [!NOTE]
82-
> To reference a method that has one parameter and returns a value, use the generic <xref:System.Func%602> delegate instead.
83-
84-
When you use the <xref:System.Action%601> delegate, you do not have to explicitly define a delegate that encapsulates a method with a single parameter. For example, the following code explicitly declares a delegate named `DisplayMessage` and assigns a reference to either the <xref:System.Console.WriteLine%2A> method or the `ShowWindowsMessage` method to its delegate instance.
85-
82+
> To reference a method that has one parameter and returns a value, use the generic <xref:System.Func%602> delegate instead.
83+
84+
When you use the <xref:System.Action%601> delegate, you do not have to explicitly define a delegate that encapsulates a method with a single parameter. For example, the following code explicitly declares a delegate named `DisplayMessage` and assigns a reference to either the <xref:System.Console.WriteLine%2A> method or the `ShowWindowsMessage` method to its delegate instance.
85+
86+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp" id="Snippet1":::
8687
:::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/Delegate.cs" id="Snippet1":::
8788
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action~1/fs/Delegate.fs" id="Snippet1":::
88-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~1/vb/Delegate.vb" id="Snippet1":::
89-
90-
The following example simplifies this code by instantiating the <xref:System.Action%601> delegate instead of explicitly defining a new delegate and assigning a named method to it.
91-
89+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~1/vb/Delegate.vb" id="Snippet1":::
90+
91+
The following example simplifies this code by instantiating the <xref:System.Action%601> delegate instead of explicitly defining a new delegate and assigning a named method to it.
92+
93+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp" id="Snippet2":::
9294
:::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/Action1.cs" id="Snippet2":::
9395
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action~1/fs/Action1.fs" id="Snippet2":::
94-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~1/vb/Action1.vb" id="Snippet2":::
95-
96-
You can also use the <xref:System.Action%601> 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).)
97-
98-
:::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/Anon.cs" id="Snippet3":::
99-
100-
You can also assign a lambda expression to an <xref:System.Action%601> delegate instance, as the following example illustrates. (For an introduction to lambda expressions, see [Lambda Expressions](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions).)
101-
96+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~1/vb/Action1.vb" id="Snippet2":::
97+
98+
You can also use the <xref:System.Action%601> 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).)
99+
100+
:::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/Anon.cs" id="Snippet3":::
101+
102+
You can also assign a lambda expression to an <xref:System.Action%601> delegate instance, as the following example illustrates. (For an introduction to lambda expressions, see [Lambda Expressions](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions).)
103+
102104
:::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/Lambda.cs" id="Snippet4":::
103105
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action~1/fs/Lambda.fs" id="Snippet4":::
104-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~1/vb/lambda.vb" id="Snippet4":::
105-
106-
The <xref:System.Collections.Generic.List%601.ForEach%2A> and <xref:System.Array.ForEach%2A> methods each take an <xref:System.Action%601> delegate as a parameter. The method encapsulated by the delegate allows you to perform an action on each element in the array or list. The example uses the <xref:System.Collections.Generic.List%601.ForEach%2A> method to provide an illustration.
107-
108-
109-
110-
## Examples
111-
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.
106+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~1/vb/lambda.vb" id="Snippet4":::
107+
108+
The <xref:System.Collections.Generic.List%601.ForEach%2A> and <xref:System.Array.ForEach%2A> methods each take an <xref:System.Action%601> delegate as a parameter. The method encapsulated by the delegate allows you to perform an action on each element in the array or list. The example uses the <xref:System.Collections.Generic.List%601.ForEach%2A> method to provide an illustration.
109+
110+
111+
112+
## Examples
113+
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.
112114
113115
:::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/action.cs" interactive="try-dotnet-method" id="Snippet01":::
114116
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action_PrintExample/fs/action.fs" id="Snippet01":::
115-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action_PrintExample/vb/action.vb" id="Snippet01":::
116-
117+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action_PrintExample/vb/action.vb" id="Snippet01":::
118+
117119
]]></format>
118120
</remarks>
119121
<altmember cref="T:System.Func`2" />

0 commit comments

Comments
 (0)