Does c# have anything like std::numeric_limits in c++?
You should perhaps explain what std::numeric_limits is or does, for those of us who know C# but not C++ (or at least haven't touched C++ for years ).
Why is my data not saved to my database? | MSDN Data Walkthroughs VBForums Database Development FAQ My CodeBank Submissions: VB | C# My Blog: Data Among Multiple Forms (3 parts) Beginner Tutorials: VB | C# | SQL
It defines the max and min numbers for the machine. Code: const int MaxInt = (std::numeric_limits<int>::max)(); const double MaxDouble = (std::numeric_limits<double>::max)(); const double MinDouble = (std::numeric_limits<double>::min)(); const float MaxFloat = (std::numeric_limits<float>::max)(); const float MinFloat = (std::numeric_limits<float>::min)();
const int MaxInt = (std::numeric_limits<int>::max)(); const double MaxDouble = (std::numeric_limits<double>::max)(); const double MinDouble = (std::numeric_limits<double>::min)(); const float MaxFloat = (std::numeric_limits<float>::max)(); const float MinFloat = (std::numeric_limits<float>::min)();
All the standard numeric types have static MinValue and MaxValue fields that return their minimum and maximum values: Code: const int MaxInt = int.MaxValue; const double MaxDouble = double.MaxValue; const double MinDouble = double.MinValue; const float MaxFloat = float.MaxValue; const float MinFloat = float.MinValue; etc. There's no point declaring your own constants though. Just use those fields as and when required.
const int MaxInt = int.MaxValue; const double MaxDouble = double.MaxValue; const double MinDouble = double.MinValue; const float MaxFloat = float.MaxValue; const float MinFloat = float.MinValue;
Thanks! I knew it would be something easy, but I couldn't find it in my beginning c# book.
Forum Rules