Point class in C#

前端 未结 6 1202
醉梦人生
醉梦人生 2021-01-02 04:33

I\'m pretty new to C# and I\'m trying to do something but without much success. I am trying to use the class Point (the one with coordinates).

This is t

6条回答
  •  走了就别回头了
    2021-01-02 05:19

    If you just want to use a simple structure for 2 ints, you can use the Tuple class (from the System namespace).

    Tuple point = new Tuple(2, 5);

    In time: As stated by @Aaron Hudon on comments, be aware that a Tuple is a class (so, by using it you'll be having an instance's reference) while a Point is a struct. Thanks for the observation Aaron Hudon.

提交回复
热议问题