本文整理汇总了C#中System.ValueType类的典型用法代码示例。如果您正苦于以下问题:C# ValueType类的具体用法?C# ValueType怎么用?C# ValueType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ValueType类属于System命名空间,在下文中一共展示了ValueType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Range
/// <summary>
/// 分割数を指定して初期化。
/// </summary>
/// <param name="variable">変数</param>
/// <param name="min">最小値</param>
/// <param name="max">最大値</param>
/// <param name="n">分割数</param>
public Range(Variable variable, ValueType min, ValueType max, int n)
{
this.variable = variable;
this.min = min;
this.max = max;
this.step = (max - min) / (ValueType)n;
}
示例2: GetHashCode
public static int GetHashCode(ValueType aThis)
{
if (aThis is byte)
return (int)aThis;
return -1;
}
示例3: DataTypeCheck
/// <summary>
///
/// </summary>
/// <remarks></remarks>
/// <seealso cref=""/>
/// <param name="name"></param>
/// <param name="dataType"></param>
public DataTypeCheck(string name, string dataType, DecimalCharacter decimalCharacter)
{
this.appliedTo = ValueType.Number;
this.name = name;
this.dataType = dataType;
this.decimalCharacter = decimalCharacter;
}
示例4: ParameterDefintion
public ParameterDefintion(string ParameterName, ParamAllowType AllowType, ValueType ValueType, string ParameterHelp)
{
this.Parameter = ParameterName;
this.AllowType = AllowType;
this.ValueType = ValueType;
this.Help = ParameterHelp;
}
示例5: TimeCondition
internal TimeCondition(ValueType valueType, CounterType counter, uint value, DayOfWeek dayOfWeek)
{
ValueType = valueType;
CounterType = counter;
Value = value;
DayOfWeek = dayOfWeek;
}
示例6: InstanceMethods
static InstanceMethods()
{
DateTime dateTime = new DateTime();
ValueType valueType = dateTime;
//new DateTime(0x270f, 12, 31, 23, 59, 59, 0x3e7, DateTimeKind.Utc)
InstanceMethods.maxValidCimTimestamp = valueType;
}
示例7: ToArray
/// <summary>
/// Сериализует значение (Mpower или ushort (mmmm кВт*ч)) в массив
/// из 2 байт в BCD формате
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static byte[] ToArray(ValueType value)
{
if (value is Menerg)
{
var bcd = (Menerg)value;
return BitConverter.GetBytes(bcd._powerLimitBcd);
}
else if (value is ushort)
{
var x = (ushort)value;
if (x >= 10000)
{
throw new ArgumentOutOfRangeException(
"Значение лимта мощьности не можеть быть больше или равно 100");
}
var bcd = BcdConverter.ToBcdUInt16(x);
return BitConverter.GetBytes(bcd);
}
else
{
throw new InvalidCastException("Невозможно сериализовать значение");
}
}
示例8: ImmediateValue
public ImmediateValue(ValueType value)
{
if (value == null)
throw new ArgumentNullException("value");
else
Value = value;
}
示例9: EnumerateUDT
internal static object EnumerateUDT(ValueType oStruct, IRecordEnum intfRecEnum, bool fGet)
{
Type typ = oStruct.GetType();
if ((Information.VarTypeFromComType(typ) != VariantType.UserDefinedType) || typ.IsPrimitive)
{
throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue1", new string[] { "oStruct" }));
}
FieldInfo[] fields = typ.GetFields(BindingFlags.Public | BindingFlags.Instance);
int num2 = 0;
int num4 = fields.GetUpperBound(0);
for (int i = num2; i <= num4; i++)
{
FieldInfo fieldInfo = fields[i];
Type fieldType = fieldInfo.FieldType;
object obj3 = fieldInfo.GetValue(oStruct);
if (Information.VarTypeFromComType(fieldType) == VariantType.UserDefinedType)
{
if (fieldType.IsPrimitive)
{
throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { fieldInfo.Name, fieldType.Name })), 5);
}
EnumerateUDT((ValueType) obj3, intfRecEnum, fGet);
}
else
{
intfRecEnum.Callback(fieldInfo, ref obj3);
}
if (fGet)
{
fieldInfo.SetValue(oStruct, obj3);
}
}
return null;
}
示例10: OptionalCheck
/// <summary>
///
/// </summary>
/// <remarks></remarks>
/// <seealso cref=""/>
/// <param name="name"></param>
/// <param name="dataType"></param>
/// <param name="optional"></param>
public OptionalCheck(string name, string dataType, bool optional)
{
this.appliedTo = ValueType.All;
this.optional = optional;
this.name = name;
this.dataType = dataType;
}
示例11: TypeLayoutCanBeControlledUsingStructLayoutAttribute
public void TypeLayoutCanBeControlledUsingStructLayoutAttribute()
{
ValueType value = new ValueType(1, 2);
value.X.ShouldBe(1);
value.Y.ShouldBe(2);
}
示例12: TestUseCase
public static void TestUseCase(Assert assert)
{
assert.Expect(7);
var t1 = new Type();
assert.Ok(t1 != null, "#565 t1");
var t2 = new ValueType();
assert.Ok(t2 != null, "#565 t2");
var t3 = new IntPtr();
assert.Ok(t3.GetType() == typeof(IntPtr) , "#565 t3");
var t4 = new UIntPtr();
assert.Ok(t4.GetType() == typeof(UIntPtr), "#565 t4");
var t5 = new ParamArrayAttribute();
assert.Ok(t5 != null, "#565 t5");
var t6 = new RuntimeTypeHandle();
assert.Ok(t6.GetType() == typeof(RuntimeTypeHandle), "#565 t6");
var t7 = new RuntimeFieldHandle();
assert.Ok(t7.GetType() == typeof(RuntimeFieldHandle), "#565 t7");
}
示例13: StructureId
private StructureId(ValueType value, Type dataType, StructureIdTypes idType)
{
_value = value;
_hasValue = value != null;
_dataType = dataType;
_idType = idType;
}
示例14: BasicBinaryOperator
public BasicBinaryOperator(string @operator, ValueType operandsAndReturnType, Func<object, object, object> evaluator)
{
_evaluator = evaluator;
Operator = @operator;
ReturnType = operandsAndReturnType;
LHS = operandsAndReturnType;
RHS = operandsAndReturnType;
}
示例15: CheckControlParams
public CheckControlParams(string name,string value,string errormsg, ValueType valueType,bool isRequired)
{
Name = name;
Value = value;
Type = valueType;
Errormsg = errormsg;
IsRequired = isRequired;
}