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


C# FSharpList.Select方法代码示例

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


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

示例1: __eval_internal

        protected virtual void __eval_internal(FSharpList<FScheme.Value> args, Dictionary<PortData, FScheme.Value> outPuts)
        {
            var t = GetType();
            if (t != typeof(Watch) && !typeof(MathBase).IsAssignableFrom(t) )
            {
                args = Utils.ToFSharpList(args.Select(SIUnit.UnwrapToDoubleWithHostUnitConversion));
            }

            _errorCount = 0;
            __eval_internal_recursive(args, outPuts);
            if (_errorCount > 1)
                Error(string.Format("{0} runs generated errors.\n\n{1}", _errorCount, ToolTipText));
        }
开发者ID:riteshchandawar,项目名称:Dynamo,代码行数:13,代码来源:NodeModel.cs

示例2: Evaluate

        public override Value Evaluate(FSharpList<Value> args)
        {
            var e = new Expression(Formula);

            var functionLookup = new Dictionary<string, Value>();

            foreach (var arg in args.Select((arg, i) => new { Value = arg, Index = i }))
            {
                var parameter = InPortData[arg.Index].NickName;
                if (arg.Value.IsFunction)
                    functionLookup[parameter] = arg.Value;
                else
                    e.Parameters[parameter] = ((Value.Number)arg.Value).Item;
            }

            e.EvaluateFunction += delegate(string name, FunctionArgs fArgs)
            {
                if (functionLookup.ContainsKey(name))
                {
                    var func = ((Value.Function)functionLookup[name]).Item;
                    fArgs.Result = ((Value.Number)func.Invoke(
                        Utils.SequenceToFSharpList(
                            fArgs.Parameters.Select<Expression, Value>(
                                p => Value.NewNumber(Convert.ToDouble(p.Evaluate())))))).Item;
                }
                else
                {
                    fArgs.HasResult = false;
                }
            };

            return Value.NewNumber(Convert.ToDouble(e.Evaluate()));
        }
开发者ID:epeter61,项目名称:Dynamo,代码行数:33,代码来源:dynEquation.cs

示例3: __eval_internal

        protected internal virtual void __eval_internal(FSharpList<Value> args, Dictionary<PortData, Value> outPuts)
        {
            var argList = new List<string>();
            if (args.Count() > 0)
            {
                argList = args.Select(x => x.ToString()).ToList<string>();
            }
            var outPutsList = new List<string>();
            if(outPuts.Count() > 0)
            {
                outPutsList = outPuts.Keys.Select(x=>x.NickName).ToList<string>();
            }

            Debug.WriteLine(string.Format("__eval_internal : {0} : {1}",
                string.Join(",", argList),
                string.Join(",", outPutsList)));

            Evaluate(args, outPuts);
        }
开发者ID:hippo811028,项目名称:Dynamo,代码行数:19,代码来源:dynNode.cs

示例4: Evaluate

        public override Value Evaluate(FSharpList<Value> args)
        {
            var e = new Expression(FormulaString.ToLower(), EvaluateOptions.IgnoreCase);

            e.Parameters["pi"] = 3.14159265358979;

            var functionLookup = new Dictionary<string, Value>();

            foreach (var arg in args.Select((arg, i) => new { Value = arg, Index = i }))
            {
                var parameter = InPortData[arg.Index].NickName;
                if (arg.Value.IsFunction)
                    functionLookup[parameter] = arg.Value;
                else
                {
                    if (arg.Value.IsNumber)
                    {
                        e.Parameters[parameter] = ((Value.Number)arg.Value).Item;
                    }
                    else if (arg.Value.IsContainer)
                    {
                        e.Parameters[parameter] = SIUnit.UnwrapToSIUnit(arg.Value).Value * dynSettings.Controller.UnitsManager.UiLengthConversion;
                    }
                }
            }

            e.EvaluateFunction += delegate(string name, FunctionArgs fArgs)
            {
                if (functionLookup.ContainsKey(name))
                {
                    var func = ((Value.Function)functionLookup[name]).Item;
                    fArgs.Result = ((Value.Number)func.Invoke(
                        Utils.ToFSharpList(
                            fArgs.Parameters.Select(
                                p => Value.NewNumber(Convert.ToDouble(p.Evaluate())))))).Item;
                }
                else
                {
                    fArgs.HasResult = false;
                }
            };

            return Value.NewNumber(Convert.ToDouble(e.Evaluate()));
        }
开发者ID:parchjs,项目名称:Dynamo,代码行数:44,代码来源:dynFormula.cs

示例5: __eval_internal

        protected virtual void __eval_internal(FSharpList<FScheme.Value> args, Dictionary<PortData, FScheme.Value> outPuts)
        {
            //HACK: This allows us to apply a host units conversion for all
            //types in the DynamoRevit library
            if (GetType().Assembly.GetName().Name == "DynamoRevit")
            {
                args = args.Select(Utils.UnwrapToDoubleWithHostUnitConversion).ToFSharpList();
            }

            _errorCount = 0;
            __eval_internal_recursive(args, outPuts);
            if (_errorCount > 1)
                Error(string.Format("{0} runs generated errors.\n\n{1}", _errorCount, ToolTipText));
        }
开发者ID:jimmplan,项目名称:Dynamo,代码行数:14,代码来源:NodeModel.cs

示例6: Evaluate

 public override Expression Evaluate(FSharpList<Expression> args)
 {
     var procedure = this.Bench.Environment.LookupSymbol(this.Symbol);
     if (procedure.IsFunction)
     {
         return (procedure as Expression.Function).Item
            .Invoke(ExecutionEnvironment.IDENT)
            .Invoke(
               Utils.convertSequence(
                  args.Select(
                     input => this.macroEnvironment.Evaluate(input)
                  )
               )
            );
     }
     else
         return base.Evaluate(args);
 }
开发者ID:Dewb,项目名称:Dynamo,代码行数:18,代码来源:dynFunction.cs

示例7: evalIfDirty

        private Expression evalIfDirty(FSharpList<Expression> args, ExecutionEnvironment environment)
        {
            //If this node requires a re-calc or if we haven't calc'd yet...
            if (this.IsDirty || this.oldValue == null)
            {
                //Store the environment
                this.macroEnvironment = environment;

                //Evaluate arguments, then evaluate this.
                this.oldValue = this.eval(
                   Utils.convertSequence(
                      args.Select(
                         input => environment.Evaluate(input)
                      )
                   )
                );
            }
            else //Otherwise, just increment the run counter.
                this.runCount++;

            //We're done here
            return this.oldValue;
        }
开发者ID:Dewb,项目名称:Dynamo,代码行数:23,代码来源:dynNode.xaml.cs


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