当前位置: 首页>>代码示例>>C#>>正文


C# IValue.AsString方法代码示例

本文整理汇总了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());
        }
开发者ID:Shemetov,项目名称:OneScript,代码行数:13,代码来源:PropertyNameIndexAccessor.cs

示例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());
        }
开发者ID:Shemetov,项目名称:OneScript,代码行数:13,代码来源:PropertyNameIndexAccessor.cs

示例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();
        }
开发者ID:Shemetov,项目名称:OneScript,代码行数:26,代码来源:ValueTableColumnCollection.cs

示例4: Equals

 public override bool Equals(IValue other)
 {
     return _val == other.AsString();
 }
开发者ID:Shemetov,项目名称:OneScript,代码行数:4,代码来源:SymbolsEnum.cs

示例5: CompareTo

 public override int CompareTo(IValue other)
 {
     return _val.CompareTo(other.AsString());
 }
开发者ID:Shemetov,项目名称:OneScript,代码行数:4,代码来源:SymbolsEnum.cs

示例6: Constructor

 public static IRuntimeContextInstance Constructor(IValue strProperties, IValue[] args)
 {
     return new StructureImpl(strProperties.AsString(), args);
 }
开发者ID:Shemetov,项目名称:OneScript,代码行数:4,代码来源:StructureImpl.cs

示例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;
     
 }
开发者ID:Shemetov,项目名称:OneScript,代码行数:24,代码来源:SystemGlobalContext.cs

示例8: Create

 public static GuidWrapper Create(IValue uuidString)
 {
     return new GuidWrapper(uuidString.AsString());
 }
开发者ID:Shemetov,项目名称:OneScript,代码行数:4,代码来源:GuidWrapper.cs

示例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;
            }
        }
开发者ID:Shemetov,项目名称:OneScript,代码行数:34,代码来源:TextEncodingEnum.cs

示例10: Equals

 public bool Equals(IValue other)
 {
     if (other.DataType == this.DataType)
     {
         var scv = other.AsString();
         return scv == this._value;
     }
     else
     {
         return false;
     }
 }
开发者ID:Shemetov,项目名称:OneScript,代码行数:12,代码来源:GenericValue.cs

示例11: CompareTo

        public int CompareTo(IValue other)
        {
            if(other.DataType == DataType.String)
                return _value.CompareTo(other.AsString());

            throw RuntimeException.ComparisonNotSupportedException();
        }
开发者ID:Shemetov,项目名称:OneScript,代码行数:7,代码来源:GenericValue.cs


注:本文中的IValue.AsString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。