You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
62
mcs/class/referencesource/System.Data/System/Data/Range.cs
Normal file
62
mcs/class/referencesource/System.Data/System/Data/Range.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="Range.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
// <owner current="true" primary="true">[....]</owner>
|
||||
// <owner current="true" primary="false">[....]</owner>
|
||||
// <owner current="false" primary="false">[....]</owner>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace System.Data {
|
||||
using System;
|
||||
|
||||
internal struct Range {
|
||||
|
||||
private int min;
|
||||
private int max;
|
||||
private bool isNotNull; // zero bit pattern represents null
|
||||
|
||||
public Range(int min, int max) {
|
||||
if (min > max) {
|
||||
throw ExceptionBuilder.RangeArgument(min, max);
|
||||
}
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
isNotNull = true;
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get {
|
||||
if (IsNull)
|
||||
return 0;
|
||||
return max - min + 1;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsNull {
|
||||
get {
|
||||
return !isNotNull;
|
||||
}
|
||||
}
|
||||
|
||||
public int Max {
|
||||
get {
|
||||
CheckNull();
|
||||
return max;
|
||||
}
|
||||
}
|
||||
|
||||
public int Min {
|
||||
get {
|
||||
CheckNull();
|
||||
return min;
|
||||
}
|
||||
}
|
||||
|
||||
internal void CheckNull() {
|
||||
if (this.IsNull) {
|
||||
throw ExceptionBuilder.NullRange();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user