本文整理汇总了C#中DataObject.Add方法的典型用法代码示例。如果您正苦于以下问题:C# DataObject.Add方法的具体用法?C# DataObject.Add怎么用?C# DataObject.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObject
的用法示例。
在下文中一共展示了DataObject.Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialization
public void Initialization()
{
object1 = new DataObject { Id = 1 };
object1.Add("x", 2);
object1.Add("y", 2);
object2 = new DataObject { Id = 2 };
object2.Add("x", 5);
object2.Add("y", 2);
object3 = new DataObject { Id = 3 };
object3.Add("x", 4);
object3.Add("y", 3);
object4 = new DataObject { Id = 4 };
object4.Add("x", 3);
object4.Add("y", 6);
object5 = new DataObject { Id = 5 };
object5.Add("x", 8);
object5.Add("y", 8);
object6 = new DataObject { Id = 6 };
object6.Add("x", 9);
object6.Add("y", 7);
}
示例2: InputOutputTest
public void InputOutputTest()
{
var test = new DataObject { Id = 1 };
test.Add("x", 2);
test.Add("y", 2);
Assert.AreEqual(1, test.Id);
Assert.AreEqual((double)2, test.Get("x"));
Assert.AreEqual((double)2, test.Get("y"));
foreach (DictionaryEntry item in test)
{
Assert.AreEqual((double)2, item.Value);
Assert.IsTrue((string)item.Key == "x" || (string)item.Key == "y");
}
}
示例3: EvaluateBinary
protected override DataObject EvaluateBinary(DataObject ob1, DataObject ob2, IEvaluateContext context)
{
return ob1.Add(ob2);
}
示例4: EvaluateBinary
private DataObject EvaluateBinary(DataObject left, SqlExpressionType binaryType, DataObject right)
{
if (binaryType.IsAll())
return left.Any(binaryType.SubQueryPlainType(), right, context);
if (binaryType.IsAny())
return left.All(binaryType.SubQueryPlainType(), right, context);
switch (binaryType) {
case SqlExpressionType.Add:
return left.Add(right);
case SqlExpressionType.Subtract:
return left.Subtract(right);
case SqlExpressionType.Multiply:
return left.Multiply(right);
case SqlExpressionType.Divide:
return left.Divide(right);
case SqlExpressionType.Modulo:
return left.Modulus(right);
case SqlExpressionType.GreaterThan:
return left.IsGreaterThan(right);
case SqlExpressionType.GreaterOrEqualThan:
return left.IsGreterOrEqualThan(right);
case SqlExpressionType.SmallerThan:
return left.IsSmallerThan(right);
case SqlExpressionType.SmallerOrEqualThan:
return left.IsSmallerOrEqualThan(right);
case SqlExpressionType.Equal:
return left.IsEqualTo(right);
case SqlExpressionType.NotEqual:
return left.IsNotEqualTo(right);
case SqlExpressionType.Is:
return left.Is(right);
case SqlExpressionType.IsNot:
return left.IsNot(right);
case SqlExpressionType.Like:
return left.IsLike(right);
case SqlExpressionType.NotLike:
return left.IsNotLike(right);
case SqlExpressionType.And:
return left.And(right);
case SqlExpressionType.Or:
return left.Or(right);
case SqlExpressionType.XOr:
return left.XOr(right);
// TODO: ANY and ALL
default:
throw new ExpressionEvaluateException(String.Format("The type {0} is not a binary expression or is not supported.", binaryType));
}
}
示例5: Evaluate
public override DataObject Evaluate(DataObject ob1, DataObject ob2, IGroupResolver group, IVariableResolver resolver, IQueryContext context)
{
return ob1.Add(ob2);
}