{"action":"opened","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/2636","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/2636/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/2636/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/2636/events","html_url":"https://github.com/dotnet/corefx/issues/2636","id":99277977,"number":2636,"title":"Semantic equals for BitArray","user":{"login":"alexandrugyori","id":1882366,"avatar_url":"https://avatars.githubusercontent.com/u/1882366?v=3","gravatar_id":"","url":"https://api.github.com/users/alexandrugyori","html_url":"https://github.com/alexandrugyori","followers_url":"https://api.github.com/users/alexandrugyori/followers","following_url":"https://api.github.com/users/alexandrugyori/following{/other_user}","gists_url":"https://api.github.com/users/alexandrugyori/gists{/gist_id}","starred_url":"https://api.github.com/users/alexandrugyori/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexandrugyori/subscriptions","organizations_url":"https://api.github.com/users/alexandrugyori/orgs","repos_url":"https://api.github.com/users/alexandrugyori/repos","events_url":"https://api.github.com/users/alexandrugyori/events{/privacy}","received_events_url":"https://api.github.com/users/alexandrugyori/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-05T19:18:46Z","updated_at":"2015-08-05T19:18:46Z","closed_at":null,"body":"The Equals method of BitArray is inherited from Object. I believe most things in the Collections API have an Equals that is specific to the collection itself. I think it would be more intuitive for BitArray to have a proper Equals implementation.\r\n\r\nIn my understanding this test should pass but it currently fails:\r\n\r\nvoid TestEquals()\r\n {\r\n            BitArray b = new BitArray(251);\r\n            Random r = new Random(234432);\r\n            for (int i = 0; i < b.Count; i++)\r\n            {\r\n                b.Set(i, r.Next() % 2 == 0);\r\n            }\r\n            BitArray fresh = new BitArray(251);\r\n\r\n            BitArray copy = b.Clone() as BitArray;\r\n\r\n            b.Or(fresh);\r\n            Debug.Assert(b.Equals(copy));\r\n            b.Or(copy);\r\n            Debug.Assert(b.Equals(copy));\r\n}"}}