Snippet: IComparer class

property value
IDE VS Code
Language C#
Title IComparer class
Shortcut c_IComparer
Description class that implements IComparer

Placeholders

Identifier Tooltip Default Value
modifier Modifier(s) public
name Comparer type name Comparer
type Type name object

Code

public class Comparer : IComparer {
	public int Compare(object x, object y) {
		if (object.ReferenceEquals(x, y)) {
			return 0;
		}

		if (x == null) {
			return (y == null) ? 0 : -1;
		}

		if (y == null) {
			return 1;
		}

		var a = (object)x;
		var b = (object)y;

		
		throw new NotImplementedException();
	}
}