How to convert a string into a Point?

后端 未结 4 1130
执笔经年
执笔经年 2020-12-21 02:43

I have a list of strings of the format \"x,y\". I would like to make them all into Points. The best Point constructor I can find takes two ints. What is the best way in C# t

4条回答
  •  一生所求
    2020-12-21 03:05

    Like this:

    string[] coords = str.Split(',');
    
    Point point = new Point(int.Parse(coords[0]), int.Parse(coords[1]));
    

提交回复
热议问题