c# can struct have methods code example
Example 1: c# struct
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})";
}
Example 2: structure in c sharp with example
struct Books {
public string title;
public string author;
public string subject;
public int book_id;
};