I'm writing an utility class, that take a class name and array of property names as params like this:
public static void DoMagic(Type type, params string[] include)
and call it looks like this:
Helper.DoMagic(typeof(MyClass), "ClientId", "PointId", "SerialNumber")
But i don't like it, couse there is no compile-check, and if i make mistake in string params, it will only runtime error, not compile error.
I want to do something like this:
Helper.DoMagic<MyClass>(x => x.ClientId, x => x.PointId, x => x.SerialNumber)
Or, may be, even shorter. Is there any way to do this?