I have an object like so:
public class MyObject {
public string firstname { get; set; }
public string lastname { get; set; }
public int age { get; set; }
public string occupation { get; set; }
}
I am trying to do a comparison of two objects but I want all strings to ignore case. Unfortunately the following won't compile:
// Does NOT allow me to call using ignore case
if (myObject1.Equals(myObject2, StringComparison.OrdinalIgnoreCase)) {
Console.WriteLine("Match!");
}
Is there a way to accomplish this without manually checking each property in the object?