Update from comment:
I need to extend linq-to-sql classes according to my own parameters and do not want to touch any generated classes. Any best offers are welcome. But I also don't want to do all the attribute assignments all the time again if the linq-to-sql classes change. therefore, if vstudio generates a new attribute for the class, I have my own extended attributes, which are stored separately, and a new one, placed from the class itself
The original question:
I am not sure if this is possible. I have a cool car and a T-shirt class, released from a car class. The mycar class also has a string list. Just the difference.
How can I now transfer any car object to mycar without having to assign all the attributes each manually. How:
Car car = new Car();
MyCar mcar = (MyCar) car;
or
MyCar mcar = new MyCar(car);
or, nevertheless, I can expand the car with my own variables and do not have to do
Car car = new Car();
MyCar mcar = new MyCar();
mcar.name = car.name;
mcar.xyz = car.xyz;
...
Thank.
source
share