Comments: (4)
| public static void CopyProperties(object fromObject, object toObject)
{
PropertyInfo[] aProps = fromObject.GetType().GetProperties();
FieldInfo[] aFields = fromObject.GetType().GetFields();
foreach(PropertyInfo oProp in aProps)
{
object oValue = oProp.GetValue(fromObject, null);
try
{
if (oValue != null && oProp.CanWrite)
{
PropertyInfo toProp = toObject.GetType().GetProperty(oProp.Name);
toProp.SetValue(toObject, oValue, null);
}
}
catch (Exception ex)
{
string yy = "Error = " + ex.Message;
}
}
foreach(FieldInfo oProp in aFields)
{
object oValue = oProp.GetValue(fromObject);
try
{
if (oValue != null)
{
FieldInfo toProp = toObject.GetType().GetField(oProp.Name);
toProp.SetValue(toObject, oValue);
}
}
catch{}
}
}
|
well it is very interesting. |
Hi Derick. I notice you use both Resharper and what looks like CodeRush in all your demos. Do you find they fight for resources or keyboard shortcuts? Have you tweaked one to be secondary to the other?
I'm asking because I currently use Resharper and love it, but I really appreciate knowing the cyclometric complexity of each method as I write it as CodeRush can display. If I could use that one feature from CodeRush and all of Resharper, that would be golden.
Any ideas? |
@Flipdoubt,
Yes they do fight. To get around this i turned off the refactoring features of coderush. Use it pretty much for the UI candy at this point. |
|