如何从字段中删除添加的点?

时间:2013-02-25 21:14:00

标签: c#

我可以在字段中添加点,但我无法删除它们。这是我目前使用的代码:

public class Vertex
{
    public Point p { get; private set; }
    public int ident {get; private set; }
    public int dist { get; set; }

    public Vertex(Point p, int ident)
    {
        this.p = p;
        this.ident = ident;
    }
}

2 个答案:

答案 0 :(得分:0)

您可以使用:

this.p = Point.Empty;
this.indent = 0;

因此请调用您的方法Vertex:

Vertex(Point.Empty, 0);

答案 1 :(得分:-1)

您可以为p

设置重置方法
public class Vertex
{
        public Point p { get; private set; }
        public int ident {get; private set; }
        public int dist { get; set; }

        public Vertex(Point p, int ident)
        {
            this.p = p;
            this.ident = ident;
        }

        public void Reset() { p = new Point(); }
}