I would like to assign the property MyProperty with the parameter id.
The MyProperty property is of type Object, and it may be either an Int32 or an Int64.
How could I check the type of the MyProperty field and then assign it either id or id cast as an int depending on the underlying type?
public void MyMethod(long id) {
myClass.MyProperty
= (typeof(MyProperty) == typeof(long))
? id
: (int)id;
}