serializer
Programmer
I have an old object structure I would like to convert between two objects as much as possible. I know I can serialize down and up but I rather use other way if possible. Here are the two objects:
Class 1
using System;
using System.Collections.Generic;
using System.Text;
namespace ConvertObjectTest.VisualCron2
{
public class VisualCron : ICloneable
{
private string strName;
public string Name
{
get
{
return strName;
}
set
{
strName = value;
}
}
private int intOldAge;
public int OldAge
{
get
{
return intOldAge;
}
set
{
intOldAge = value;
}
}
}
}
Class 2
using System;
using System.Collections.Generic;
using System.Text;
namespace ConvertObjectTest.VisualCron4
{
public class VisualCron
{
private string strName;
public string Name
{
get
{
return strName;
}
set
{
strName = value;
}
}
private int intNewAge;
public int NewAge
{
get
{
return intNewAge;
}
set
{
intNewAge = value;
}
}
}
}
Now, I can afford to lose "OldObject" property and fix that manually to "NewObject" but I want the similar property "Name" to be copied to the object 2.
How can I cast this to make it happen?
Class 1
using System;
using System.Collections.Generic;
using System.Text;
namespace ConvertObjectTest.VisualCron2
{
public class VisualCron : ICloneable
{
private string strName;
public string Name
{
get
{
return strName;
}
set
{
strName = value;
}
}
private int intOldAge;
public int OldAge
{
get
{
return intOldAge;
}
set
{
intOldAge = value;
}
}
}
}
Class 2
using System;
using System.Collections.Generic;
using System.Text;
namespace ConvertObjectTest.VisualCron4
{
public class VisualCron
{
private string strName;
public string Name
{
get
{
return strName;
}
set
{
strName = value;
}
}
private int intNewAge;
public int NewAge
{
get
{
return intNewAge;
}
set
{
intNewAge = value;
}
}
}
}
Now, I can afford to lose "OldObject" property and fix that manually to "NewObject" but I want the similar property "Name" to be copied to the object 2.
How can I cast this to make it happen?