سؤال

I've a question that may seem dumb a little. I'm going to read and handle lots of 2D point coordinates in my program. Should I use the default Point struct in System.Windows.Point or should I use my own struct like this?

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

Will I save memory using the second method?

هل كانت مفيدة؟

المحلول

Use the System.Windows.Point.

Reason for my recommendation:

  1. Many built-in functions are available just in case you need them later in code
  2. Readily Inter-operable with System.Windows.Geometry and other types which you may use
  3. From a 'maintenance' point of view, developers other than you who look at the code will easily understand what is happening and what else can be done.
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top