Snippet: IComparer class

property value
IDE Visual Studio
Language C#
Title IComparer class
Shortcut c_
Description class that implements IComparer
Snippet Types Expansion
Namespaces System
System.Collections

Placeholders

Identifier Tooltip Default Value Editable Function Type Name
modifier Modifier(s) public yes
name Comparer type name Comparer yes
type Type name object yes

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();
	}
}