CSharp · Console
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
public class Program
{
// Trivial wrapper class.
private class Wrapper
{
public string Value;
public override string ToString()
{
return Value;
}
}
public static void Main()
{
Console.WriteLine(string.Join("\n", new List<string>
{
// Create the same immtuable set twice and print each, may display different ordering!
string.Join(", ", new List<Wrapper>
{
new Wrapper { Value = "first" },
new Wrapper { Value = "second" },
new Wrapper { Value = "third" },
new Wrapper { Value = "fourth" },
new Wrapper { Value = "fifth" },
}.ToImmutableHashSet()),
string.Join(", ", new List<Wrapper>
{
new Wrapper { Value = "first" },
new Wrapper { Value = "second" },
new Wrapper { Value = "third" },
new Wrapper { Value = "fourth" },
new Wrapper { Value = "fifth" },
}.ToImmutableHashSet()),
}));
}
}