Guest Krassimir Manev Posted January 18, 2021 Posted January 18, 2021 I'v created IComparer for SortedList collection but compiler do not like how I'm using it: class IntReverse : IComparer { public int Compare(object x, object y) { int xcopy = (int)x, ycopy = (int)y; if (xcopy > ycopy) return -1; else return 1; } } class Program { static void Main() { IComparer comp = new IntReverse(); SortedList<int,string> a = new SortedList<int, string>(comp); } } Error message: Error CS1503 Argument 1: cannot convert from 'System.Collections.IComparer' to 'int' Continue reading... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.