Nij
0
Q:

c# struct

    struct Parts
    {
        public static Parts NewPart(string PartName, string strName, int PartId)
        {
            return new Parts
            {
                Part = PartName,
                Name = strName,
                Id = PartId
            };
        }
        public string Part { get; set; }
        public string Name { get; set; }
        public string Id { get; set; }
    }
1
public struct Coords
{
    public Coords(double x, double y)
    {
        X = x;
        Y = y;
    }

    public double X { get; }
    public double Y { get; }

    public override string ToString() => $"({X}, {Y})";
}
2
struct Coordinate
{
    public int x { get; set; }
    public int y { get; set; }

    public void SetOrigin()
    {
        this.x = 0;
        this.y = 0;
    }
}

Coordinate point = Coordinate();
point.SetOrigin();

Console.WriteLine(point.x); //output: 0  
Console.WriteLine(point.y); //output: 0  
0

New to Communities?

Join the community