diff --git a/snippets/fsharp/System/HashCode/Overview/example1.fs b/snippets/fsharp/System/HashCode/Overview/example1.fs
new file mode 100644
index 00000000000..6163df257da
--- /dev/null
+++ b/snippets/fsharp/System/HashCode/Overview/example1.fs
@@ -0,0 +1,30 @@
+module example1
+
+//
+open System
+open System.Collections.Generic
+
+[]
+type OrderOrderLine(orderId: int, orderLineId: int) =
+ member _.OrderId = orderId
+ member _.OrderLineId = orderLineId
+
+ override _.GetHashCode() =
+ HashCode.Combine(orderId, orderLineId)
+
+ override this.Equals(obj) =
+ match obj with
+ | :? OrderOrderLine as o -> (this :> IEquatable<_>).Equals o
+ | _ -> false
+
+ interface IEquatable with
+ member _.Equals(other: OrderOrderLine) =
+ orderId = other.OrderId && orderLineId = other.OrderLineId
+
+let set =
+ HashSet [ OrderOrderLine(1, 1); OrderOrderLine(1, 1); OrderOrderLine(1, 2) ]
+printfn $"Item count: {set.Count}."
+
+// The example displays the following output:
+// Item count: 2.
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/HashCode/Overview/example2.fs b/snippets/fsharp/System/HashCode/Overview/example2.fs
new file mode 100644
index 00000000000..65b78e491ed
--- /dev/null
+++ b/snippets/fsharp/System/HashCode/Overview/example2.fs
@@ -0,0 +1,42 @@
+module example2
+
+//
+open System
+open System.Collections.Generic
+
+[]
+type Path([]segments: string[]) =
+ member _.Segments =
+ Array.AsReadOnly segments
+
+ override this.Equals(obj) =
+ match obj with
+ | :? Path as o -> (this :> IEquatable<_>).Equals(o)
+ | _ -> false
+
+ interface IEquatable with
+ member this.Equals(other: Path) =
+ Object.ReferenceEquals(this.Segments, other.Segments) ||
+ not (isNull this.Segments) &&
+ not (isNull other.Segments) &&
+ this.Segments.Count = other.Segments.Count &&
+ Seq.forall2 (=) this.Segments other.Segments
+
+ override this.GetHashCode() =
+ let hash = HashCode()
+
+ for i = 0 to this.Segments.Count - 1 do
+ hash.Add this.Segments[i]
+ hash.ToHashCode()
+
+let set =
+ HashSet [
+ Path("C:", "tmp", "file.txt")
+ Path("C:", "tmp", "file.tmp")
+ Path("C:", "tmp", "file.txt") ]
+
+printfn $"Item count: {set.Count}."
+
+// The example displays the following output:
+// Item count: 2.
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/HashCode/Overview/example3.fs b/snippets/fsharp/System/HashCode/Overview/example3.fs
new file mode 100644
index 00000000000..a63dcda55f0
--- /dev/null
+++ b/snippets/fsharp/System/HashCode/Overview/example3.fs
@@ -0,0 +1,42 @@
+module example3
+
+//
+open System
+open System.Collections.Generic
+
+[]
+type Path([]segments: string[]) =
+ member _.Segments =
+ Array.AsReadOnly segments
+
+ override this.Equals(obj) =
+ match obj with
+ | :? Path as o -> (this :> IEquatable<_>).Equals(o)
+ | _ -> false
+
+ interface IEquatable with
+ member this.Equals(other: Path) =
+ Object.ReferenceEquals(this.Segments, other.Segments) ||
+ not (isNull this.Segments) &&
+ not (isNull other.Segments) &&
+ this.Segments.Count = other.Segments.Count &&
+ Seq.forall2 (fun x y -> String.Equals(x, y, StringComparison.OrdinalIgnoreCase)) this.Segments other.Segments
+
+ override this.GetHashCode() =
+ let hash = HashCode()
+
+ for i = 0 to this.Segments.Count - 1 do
+ hash.Add(this.Segments[i], StringComparer.OrdinalIgnoreCase)
+ hash.ToHashCode()
+
+let set =
+ HashSet [
+ Path("C:", "tmp", "file.txt")
+ Path("C:", "tmp", "file.tmp")
+ Path("C:", "tmp", "file.txt") ]
+
+printfn $"Item count: {set.Count}."
+
+// The example displays the following output:
+// Item count: 1.
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/HashCode/Overview/example4.fs b/snippets/fsharp/System/HashCode/Overview/example4.fs
new file mode 100644
index 00000000000..9b6730a5423
--- /dev/null
+++ b/snippets/fsharp/System/HashCode/Overview/example4.fs
@@ -0,0 +1,47 @@
+module example4
+
+//
+open System
+open System.Collections.Generic
+
+module PlatformUtils =
+ let pathEquals a b = String.Equals(a, b, StringComparison.OrdinalIgnoreCase)
+ let addPath (hash: byref) path = hash.Add(path, StringComparer.OrdinalIgnoreCase)
+
+[]
+type Path([]segments: string[]) =
+ member _.Segments =
+ Array.AsReadOnly segments
+
+ override this.Equals(obj) =
+ match obj with
+ | :? Path as o -> (this :> IEquatable<_>).Equals(o)
+ | _ -> false
+
+ interface IEquatable with
+ member this.Equals(other: Path) =
+ Object.ReferenceEquals(this.Segments, other.Segments) ||
+ not (isNull this.Segments) &&
+ not (isNull other.Segments) &&
+ this.Segments.Count = other.Segments.Count &&
+ Seq.forall2 PlatformUtils.pathEquals this.Segments other.Segments
+
+ override this.GetHashCode() =
+ let mutable hash = HashCode()
+
+ for i = 0 to this.Segments.Count - 1 do
+ PlatformUtils.addPath &hash this.Segments[i]
+ hash.ToHashCode()
+
+
+let set =
+ HashSet [
+ Path("C:", "tmp", "file.txt")
+ Path("C:", "TMP", "file.txt")
+ Path("C:", "tmp", "FILE.TXT") ]
+
+printfn $"Item count: {set.Count}."
+
+// The example displays the following output:
+// Item count: 1.
+//
\ No newline at end of file
diff --git a/snippets/fsharp/System/HashCode/Overview/fs.fsproj b/snippets/fsharp/System/HashCode/Overview/fs.fsproj
new file mode 100644
index 00000000000..81a6369fde3
--- /dev/null
+++ b/snippets/fsharp/System/HashCode/Overview/fs.fsproj
@@ -0,0 +1,13 @@
+
+
+ Exe
+ net6.0
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xml/System/HashCode.xml b/xml/System/HashCode.xml
index c4f933f435a..26c10951e79 100644
--- a/xml/System/HashCode.xml
+++ b/xml/System/HashCode.xml
@@ -53,6 +53,7 @@ single hash code. This structure operates in one of two ways:
The static methods combine the default hash codes of up to eight values.
:::code language="csharp" source="~/snippets/csharp/System/HashCode/Overview/example1.cs" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/HashCode/Overview/example1.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.hashcode.structure/vb/example1.vb" id="Snippet1":::
### Instance Methods
@@ -63,17 +64,20 @@ The static methods combine the default hash codes of up to eight values.
The instance methods combine the hash codes of more than eight values.
:::code language="csharp" source="~/snippets/csharp/System/HashCode/Overview/example2.cs" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/HashCode/Overview/example2.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.hashcode.structure/vb/example2.vb" id="Snippet1":::
The instance methods also combine the hash codes produced by a specific
implementation.
:::code language="csharp" source="~/snippets/csharp/System/HashCode/Overview/example3.cs" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/HashCode/Overview/example3.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.hashcode.structure/vb/example3.vb" id="Snippet1":::
The structure must be passed by-reference to other methods, as it is a value type.
:::code language="csharp" source="~/snippets/csharp/System/HashCode/Overview/example4.cs" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System/HashCode/Overview/example4.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.hashcode.structure/vb/example4.vb" id="Snippet1":::
]]>