Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First of all, that should not be a struct. It's larger than 16 bytes, so you don't get the performance benefits of having a struct. Also, it doesn't represent a single value, so it doesn't make sense semantically to make it a struct. Just make it a class instead.</p> <p>The <code>Array</code> class has a <code>Sort</code> method that you can use:</p> <pre><code>Array.Sort(theArray, (x,y) =&gt; string.Compare(x.Artist,y.Artist)); </code></pre> <p>If you don't have C# 3 you use a delegate instead of the lambda expression:</p> <pre><code>Array.Sort(theArray, delegate(uLib x, uLib y) { return string.Compare(x.Artist,y.Artist) } ); </code></pre> <p>Edit:<br> Here's an example of what your data could look like as a class:</p> <pre><code>public class ULib { private string _path, _artist, _title, _album, _length; public string Path { get { return _path; } set { _path = value; } } public string Artist { get { return _artist; } set { _artist = value; } } public string Title { get { return _title; } set { _title = value; } } public string Album { get { return _album; } set { _album = value; } } public string Length { get { return _length; } set { _length = value; } } public ULib() {} public ULib(string path, string artist, string title, string album, string length) { Path = path; Artist = artist; Title = title; Album = album; Length = length; } } </code></pre> <p>In C# there there is a short form for a property. Instead of writing code for a private variable and a setter and getter to access it, this creates that automatically:</p> <pre><code>public string Path { get; set; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload