Table of Contents

NBMsgPack070: UseComparerAttribute type must not be an open generic

UseComparerAttribute should specify a concrete type, not an open generic type.

Example violation

[UseComparer(typeof(MyComparer<>))]
public HashSet<string> MyHashSet { get; set; } = new();

Resolution

Specify a concrete type instead of an open generic type:

[UseComparer(typeof(MyComparer<string>))]
public HashSet<string> MyHashSet { get; set; } = new(new MyComparer<string>());