简体   繁体   中英

Maximum/Minimum Object

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?

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.

我将创建一个自定义类,并将其命名为与两个双打的含义相关的名称

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM