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


C# IOption.Get方法代码示例

本文整理汇总了C#中IOption.Get方法的典型用法代码示例。如果您正苦于以下问题:C# IOption.Get方法的具体用法?C# IOption.Get怎么用?C# IOption.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IOption的用法示例。


在下文中一共展示了IOption.Get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetExpandoObject

        private static ExpandoObject GetExpandoObject(
            IOption<Member> member,
            IEnumerable<Member> rest)
        {
            var expandoObject = new ExpandoObject();
            var dictionary = (IDictionary<string, object>)expandoObject;

            if (member.IsDefined)
            {
                dictionary.Add(member.Get().Name, member.Get().Value);

                foreach (var m in rest)
                {
                    dictionary.Add(m.Name, m.Value);
                }
            }

            return expandoObject;
        }
开发者ID:bfriesen,项目名称:CondgSprachePresentation,代码行数:19,代码来源:Parser.cs

示例2: GetExpandoObject

        private static ExpandoObject GetExpandoObject(IOption<Member> firstMember, IEnumerable<Member> otherMembers)
        {
            var expandoObject = new ExpandoObject();
            var d = (IDictionary<string, object>)expandoObject;

            if (firstMember.IsDefined)
            {
                var member = firstMember.Get();
                d.Add(member.Name, member.Value);
            }

            foreach (var member in otherMembers)
            {
                d.Add(member.Name, member.Value);
            }

            return expandoObject;
        }
开发者ID:bfriesen,项目名称:MIGANGSprachePresentation,代码行数:18,代码来源:Parser.cs

示例3: TokenFloat

        public TokenFloat(IOption<IEnumerable<char>> minus, string number1, string number2)
        {
            StringBuilder sb = new StringBuilder();
            if (minus.IsDefined && !minus.IsEmpty)
            {
                foreach (char c in minus.Get())
                {
                    sb.Append(c);
                }
            }

            sb.Append(number1).Append('.').Append(number2);

            double f;
            if (!Double.TryParse(sb.ToString(), out f))
            {
                throw new ArgumentException(string.Format("Bad float format: {0}", sb));
            }
            Value = f;
        }
开发者ID:RichardVasquez,项目名称:TomlDotNet,代码行数:20,代码来源:TokenFloat.cs

示例4: TokenInteger

        internal TokenInteger(IOption<IEnumerable<char>> minus, string number)
        {
            StringBuilder sb = new StringBuilder();
            if (minus.IsDefined && !minus.IsEmpty)
            {
                foreach (char c in minus.Get())
                {
                    sb.Append(c);
                }
            }

            sb.Append(number);

            Int64 v;
            if (!Int64.TryParse(sb.ToString(), out v))
            {
                throw new ArgumentException(string.Format("Bad Int64 format: {0}", sb));
            }
            Value = v;
        }
开发者ID:RichardVasquez,项目名称:TomlDotNet,代码行数:20,代码来源:TokenInteger.cs

示例5: GetObjectArray

        private static object[] GetObjectArray(IOption<object> firstItem, IEnumerable<object> otherItems)
        {
            var list = new List<object>();

            if (firstItem.IsDefined)
            {
                list.Add(firstItem.Get());
            }

            foreach (var item in otherItems)
            {
                list.Add(item);
            }

            return list.ToArray();
        }
开发者ID:bfriesen,项目名称:MIGANGSprachePresentation,代码行数:16,代码来源:Parser.cs

示例6: GetObjectArray

        private static object[] GetObjectArray(IOption<object> item, IEnumerable<object> rest)
        {
            if (!item.IsDefined)
            {
                return new object[0];
            }

            return new[] { item.Get() }.Concat(rest).ToArray();
        }
开发者ID:bfriesen,项目名称:CondgSprachePresentation,代码行数:9,代码来源:Parser.cs


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