Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy constructor of HashSet does not copy #483

Closed
joelverhagen opened this issue Jan 6, 2024 · 0 comments · Fixed by #484
Closed

Copy constructor of HashSet does not copy #483

joelverhagen opened this issue Jan 6, 2024 · 0 comments · Fixed by #484

Comments

@joelverhagen
Copy link
Contributor

joelverhagen commented Jan 6, 2024

Repro:

using System.Diagnostics;

namespace Knapcode
{
    public static class ClassA
    {
        public static void MyMethod()
        {
            var a = new HashSet<int>();
            a.Add(1);
            a.Add(2);
            var b = new HashSet<int>(a);
            Console.WriteLine(b.Count);
        }

    }
}

Expected: 2, actual: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant