E
essamce
Guest
hi, i'm new to c#, i want to know a way to do so:
public class Location
{
public int X { get; set; }
public int Y { get; set; }
public Location() : this(0, 0) { }
public Location(int x, int y)
{
X = x;
Y = y;
}
}
public class Car
{
public Location CurrentLocation { get; set; }
void SomeCarMethod()
{
CurrentLocation.X = 5; // necessary
CurrentLocation = new Location(1, 2);
}
}
public class TempClass
{
public Car MyCar { get; set; }
void TempMethod()
{
MyCar.CurrentLocation.X = 6; // NOT ALLOWED way
var t = MyCar.CurrentLocation.X; // necessary
}
}
i'm using wpfCore3.1 vs2019
Continue reading...
public class Location
{
public int X { get; set; }
public int Y { get; set; }
public Location() : this(0, 0) { }
public Location(int x, int y)
{
X = x;
Y = y;
}
}
public class Car
{
public Location CurrentLocation { get; set; }
void SomeCarMethod()
{
CurrentLocation.X = 5; // necessary
CurrentLocation = new Location(1, 2);
}
}
public class TempClass
{
public Car MyCar { get; set; }
void TempMethod()
{
MyCar.CurrentLocation.X = 6; // NOT ALLOWED way
var t = MyCar.CurrentLocation.X; // necessary
}
}
i'm using wpfCore3.1 vs2019
Continue reading...