Question

In C#, is there a build-in-class that is intended for storing minimum and maximum values as doubles?

The Point listed here http://msdn.microsoft.com/en-us/library/system.windows.point.point(v=vs.110).aspx would word perfectly, except I cannot create this Point. I don't think it is supported with what I am doing. I just get the Point(int, int), the System.Drawing one. It is not letting add using System.Window.

So for storing 2 doubles, what do you recommend? Create my own class, actually use 2 doubles (ugh), or is there some other Object I can use?

Était-ce utile?

La solution 2

I would create a custom class and name it something related to the meaning of the two doubles

Autres conseils

The Point class is actually System.Windows.Point not System.Window.Point. Is that your problem?

Failing that, you could use a Tuple - this generic class holds two values of any type. So Tuple<double, double> would give you two doubles, accessed as thing.Item1 and thing.Item2

But seriously, if you want to store a minimum and maximum, you should really create a class with two double values named Minimum and Maximum. Don't go using some unrelated type like Point just to save a couple of lines of typing.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top