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

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -