I have two classes which have are nearly equal except the data types stored in them. One class contains all double values while other contains all float values.
class DoubleClass
{
double X;
double Y;
double Z;
}
class FloatClass
{
float X;
float Y;
float Z;
}
Now I have a point of DoubleClass which I want to convert to FloatClass.
var doubleObject = new DoubleClass();
var convertedObject = (FloatClass)doubleObject; // TODO: This
One simple way is to make a method which creates a new FloatClass object, fills all values and return it. Is there any other efficient way to do this.