本文整理汇总了C#中DataObject.CastTo方法的典型用法代码示例。如果您正苦于以下问题:C# DataObject.CastTo方法的具体用法?C# DataObject.CastTo怎么用?C# DataObject.CastTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObject
的用法示例。
在下文中一共展示了DataObject.CastTo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EvaluateBinary
protected override DataObject EvaluateBinary(DataObject ob1, DataObject ob2, IEvaluateContext context)
{
if (ob1.IsNull)
return ob1;
if (ob2.IsNull)
return ob2;
char cEscape = '\\';
if (Escape is ConstantExpression) {
// TODO: some more checks...
var escapeValue = ((ConstantExpression) Escape).Value;
cEscape = escapeValue.ToString()[0];
}
string val = ob1.CastTo(PrimitiveTypes.String()).ToStringValue();
string pattern = ob2.CastTo(PrimitiveTypes.String()).ToStringValue();
return DataObject.Boolean(PatternSearch.FullPatternMatch(pattern, val, cEscape));
}
示例2: ToDateTime
public static DataObject ToDateTime(DataObject obj)
{
return obj.CastTo(PrimitiveTypes.DateTime());
}
示例3: ToBinary
public static DataObject ToBinary(DataObject value)
{
return value.CastTo(PrimitiveTypes.Binary());
}
示例4: Cast
public static DataObject Cast(DataObject value, DataType destType)
{
return value.CastTo(destType);
}
示例5: ToTimeStamp
public static DataObject ToTimeStamp(DataObject obj)
{
return obj.CastTo(PrimitiveTypes.TimeStamp());
}
示例6: ToString
public static DataObject ToString(DataObject value)
{
return value.CastTo(PrimitiveTypes.String());
}
示例7: ToNumber
public static DataObject ToNumber(DataObject value)
{
return value.CastTo(PrimitiveTypes.Numeric());
}
示例8: Evaluate
public override DataObject Evaluate(DataObject ob1, DataObject ob2,
IGroupResolver group, IVariableResolver resolver,
IQueryContext context)
{
if (ob1.IsNull)
return ob1;
if (ob2.IsNull)
return ob2;
string val = ob1.CastTo(PrimitiveTypes.String()).ToStringValue();
string pattern = ob2.CastTo(PrimitiveTypes.String()).ToStringValue();
// TODO: return DataObject.Boolean(PatternSearch.RegexMatch(context.Context, pattern, val));
throw new NotImplementedException();
}