本文整理汇总了C#中IValue.AsString方法的典型用法代码示例。如果您正苦于以下问题:C# IValue.AsString方法的具体用法?C# IValue.AsString怎么用?C# IValue.AsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IValue
的用法示例。
在下文中一共展示了IValue.AsString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetIndexedValue
public override void SetIndexedValue(IValue index, IValue val)
{
if (index.DataType != DataType.String)
{
throw RuntimeException.InvalidArgumentType();
}
var n = FindProperty(index.AsString());
if (IsPropWritable(n))
SetPropValue(n, val);
else
throw RuntimeException.PropIsNotWritableException(index.AsString());
}
示例2: GetIndexedValue
public override IValue GetIndexedValue(IValue index)
{
if (index.DataType != DataType.String)
{
throw RuntimeException.InvalidArgumentType();
}
var n = FindProperty(index.AsString());
if (IsPropReadable(n))
return GetPropValue(n);
else
throw RuntimeException.PropIsNotReadableException(index.AsString());
}
示例3: GetColumnByIIndex
public ValueTableColumn GetColumnByIIndex(IValue index)
{
if (index.DataType == DataType.String)
{
ValueTableColumn Column = FindColumnByName(index.AsString());
if (Column == null)
throw RuntimeException.PropNotFoundException(index.AsString());
return Column;
}
if (index.DataType == DataType.Number)
{
int i_index = Decimal.ToInt32(index.AsNumber());
if (i_index < 0 || i_index >= Count())
throw RuntimeException.InvalidArgumentValue();
ValueTableColumn Column = FindColumnByIndex(i_index);
return Column;
}
if (index is ValueTableColumn) {
return index as ValueTableColumn;
}
throw RuntimeException.InvalidArgumentType();
}
示例4: Equals
public override bool Equals(IValue other)
{
return _val == other.AsString();
}
示例5: CompareTo
public override int CompareTo(IValue other)
{
return _val.CompareTo(other.AsString());
}
示例6: Constructor
public static IRuntimeContextInstance Constructor(IValue strProperties, IValue[] args)
{
return new StructureImpl(strProperties.AsString(), args);
}
示例7: IsValueFilled
public bool IsValueFilled(IValue value)
{
if (value.DataType == DataType.Undefined)
return false;
else if (value.DataType == DataType.Boolean)
return true;
else if (value.DataType == DataType.String)
return !String.IsNullOrWhiteSpace(value.AsString());
else if (value.DataType == DataType.Number)
return value.AsNumber() != 0;
else if (value.DataType == DataType.Date)
{
var emptyDate = new DateTime(1, 1, 1, 0, 0, 0);
return value.AsDate() != emptyDate;
}
else if (value.GetRawValue() is ICollectionContext)
{
var col = value.GetRawValue() as ICollectionContext;
return col.Count() != 0;
}
else
return true;
}
示例8: Create
public static GuidWrapper Create(IValue uuidString)
{
return new GuidWrapper(uuidString.AsString());
}
示例9: GetEncoding
public static Encoding GetEncoding(IValue encoding)
{
if (encoding.DataType == DataType.String)
return Encoding.GetEncoding(encoding.AsString());
else
{
if (encoding.DataType != DataType.GenericValue)
throw RuntimeException.InvalidArgumentType();
var encValue = encoding.GetRawValue() as SelfAwareEnumValue<TextEncodingEnum>;
if (encValue == null)
throw RuntimeException.InvalidArgumentType();
var encodingEnum = GlobalsManager.GetEnum<TextEncodingEnum>();
Encoding enc;
if (encValue == encodingEnum.Ansi)
enc = Encoding.GetEncoding(1251);
else if (encValue == encodingEnum.Oem)
enc = Encoding.GetEncoding(866);
else if (encValue == encodingEnum.Utf16)
enc = new UnicodeEncoding(false, true);
else if (encValue == encodingEnum.Utf8)
enc = new UTF8Encoding(true);
else if (encValue == encodingEnum.Utf8NoBOM)
enc = new UTF8Encoding(false);
else if (encValue == encodingEnum.System)
enc = Encoding.Default;
else
throw RuntimeException.InvalidArgumentValue();
return enc;
}
}
示例10: Equals
public bool Equals(IValue other)
{
if (other.DataType == this.DataType)
{
var scv = other.AsString();
return scv == this._value;
}
else
{
return false;
}
}
示例11: CompareTo
public int CompareTo(IValue other)
{
if(other.DataType == DataType.String)
return _value.CompareTo(other.AsString());
throw RuntimeException.ComparisonNotSupportedException();
}