The following code throws a NullReferenceException because Name is a field, not a property, This is unintuitive for users, so we should probably handle public fields. At the very least, we should give a better error message.
void Main()
{
Skill[] skills = new[]
{
new Skill("aaaa"),
new Skill("kkkk"),
new Skill("zzzz")
};
var result = Is.Ordered.By("Name").ApplyTo(skills);
}
public class Skill
{
public string Name;
public Skill(string name)
{
Name = name;
}
}
The following code throws a
NullReferenceExceptionbecauseNameis a field, not a property, This is unintuitive for users, so we should probably handle public fields. At the very least, we should give a better error message.