c# - to sort a collection that I do not know what type does it have? -


Is there a way. I can sort my collection in .NET when I do not know how the objects in run-time I

Any thoughts? You need to find some ways to compare elements: Generally ask for ICOMperbal:

  class MyCollection & lt; T & gt; Where T: Icom Parabal & lt; T & gt; {}  

or use IComparer, either for the sorting method or the constructor:

  class MyCollection & lt; T & gt; // where T: icomperbal & lt; T & gt; {Zero Sorted (ICMPear  Comparator) {If (comparer.Compare (a, b)> 0) {...}}}  
< / Html>

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -