Is there a way to copy a class in C#? Something like var dupe = MyClass(original).
If your class has just got properties, you could do something like this:
SubCentreMessage actual;
actual = target.FindSubCentreFullDetails(120); //for Albany
SubCentreMessage s = new SubCentreMessage();
//initialising s with the same values as
foreach (var property in actual.GetType().GetProperties())
{
PropertyInfo propertyS = s.GetType().GetProperty(property.Name);
var value = property.GetValue(actual, null);
propertyS.SetValue(s, property.GetValue(actual, null), null);
}
If you have fields and methods, I am sure you can recreate them in new class using reflections. Hope this helps