diff --git a/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Action3.fs b/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Action3.fs
new file mode 100644
index 00000000000..65a8cdc01f0
--- /dev/null
+++ b/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Action3.fs
@@ -0,0 +1,23 @@
+module TestAction3
+
+//
+open System
+
+let copyStrings (source: string []) (target: string []) startPos =
+ if source.Length <> target.Length then
+ raise (IndexOutOfRangeException "The source and target arrays must have the same number of elements.")
+
+ for i = startPos to source.Length - 1 do
+ target.[i] <- source.[i]
+
+let ordinals = [| "First"; "Second"; "Third"; "Fourth"; "Fifth" |]
+let copiedOrdinals = Array.zeroCreate ordinals.Length
+
+let copyOperation = Action<_,_,_> copyStrings
+
+copyOperation.Invoke(ordinals, copiedOrdinals, 3)
+
+for ordinal in copiedOrdinals do
+ printfn "%s" (if String.IsNullOrEmpty ordinal then "" else ordinal)
+
+//
diff --git a/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Action3.fsproj b/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Action3.fsproj
new file mode 100644
index 00000000000..68807747c7f
--- /dev/null
+++ b/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Action3.fsproj
@@ -0,0 +1,14 @@
+
+
+
+ Exe
+ net5.0
+
+
+
+
+
+
+
+
+
diff --git a/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Delegate.fs b/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Delegate.fs
new file mode 100644
index 00000000000..cbdf39e002a
--- /dev/null
+++ b/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Delegate.fs
@@ -0,0 +1,27 @@
+module TestDelegate
+
+//
+open System
+
+type StringCopy = delegate of stringArray1: string [] *
+ stringArray2: string [] *
+ indexToStart: int -> unit
+
+let copyStrings (source: string []) (target: string []) startPos =
+ if source.Length <> target.Length then
+ raise (IndexOutOfRangeException "The source and target arrays must have the same number of elements.")
+
+ for i = startPos to source.Length - 1 do
+ target.[i] <- source.[i]
+
+let ordinals = [| "First"; "Second"; "Third"; "Fourth"; "Fifth" |]
+let copiedOrdinals: string [] = Array.zeroCreate ordinals.Length
+
+let copyOperation = StringCopy copyStrings
+
+copyOperation.Invoke(ordinals, copiedOrdinals, 3)
+
+for ordinal in copiedOrdinals do
+ printfn "%s" (if String.IsNullOrEmpty ordinal then "" else ordinal)
+
+//
diff --git a/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Lambda.fs b/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Lambda.fs
new file mode 100644
index 00000000000..da1fda60236
--- /dev/null
+++ b/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Lambda.fs
@@ -0,0 +1,23 @@
+module TestLambda
+
+//
+open System
+
+let copyStrings (source: string []) (target: string []) startPos =
+ if source.Length <> target.Length then
+ raise (IndexOutOfRangeException "The source and target arrays must have the same number of elements.")
+
+ for i = startPos to source.Length - 1 do
+ target.[i] <- source.[i]
+
+let ordinals = [| "First"; "Second"; "Third"; "Fourth"; "Fifth" |]
+let copiedOrdinals: string [] = Array.zeroCreate ordinals.Length
+
+let copyOperation = Action<_,_,_> (fun s1 s2 pos -> copyStrings s1 s2 pos)
+
+copyOperation.Invoke(ordinals, copiedOrdinals, 3)
+
+for ordinal in copiedOrdinals do
+ printfn "%s" (if String.IsNullOrEmpty ordinal then "" else ordinal)
+
+//
diff --git a/xml/System/Action`3.xml b/xml/System/Action`3.xml
index b24aa76d0c7..4ed1a0fe145 100644
--- a/xml/System/Action`3.xml
+++ b/xml/System/Action`3.xml
@@ -92,7 +92,7 @@
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 three parameters that are all 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.
+ You can use the 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 three parameters that are all passed to it by value, and it must not return a value. (In C#, the method must return `void`. In F#, the method or function 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.
> [!NOTE]
> To reference a method that has three parameters and returns a value, use the generic delegate instead.
@@ -100,20 +100,23 @@
When you use the delegate, you do not 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="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Delegate.cs" interactive="try-dotnet" id="Snippet1":::
+ :::code language="fsharp" source="~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Delegate.fs" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~3/vb/Delegate.vb" id="Snippet1":::
The following example simplifies this code by instantiating the delegate instead of explicitly defining a new delegate and assigning a named method to it.
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Action3.cs" interactive="try-dotnet" id="Snippet2":::
+ :::code language="fsharp" source="~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Action3.fs" id="Snippet2":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~3/vb/Action3.vb" id="Snippet2":::
You can also use the 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="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Anon.cs" interactive="try-dotnet" id="Snippet3":::
- You can also assign a lambda expression to an 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).)
+ You can also assign a lambda expression to an 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="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Lambda.cs" interactive="try-dotnet" id="Snippet4":::
+ :::code language="fsharp" source="~/samples/snippets/fsharp/VS_Snippets_CLR_System/system.Action~3/fs/Lambda.fs" id="Snippet4":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~3/vb/lambda.vb" id="Snippet4":::
]]>