本文整理汇总了C#中Seq.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Seq.Select方法的具体用法?C# Seq.Select怎么用?C# Seq.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Seq
的用法示例。
在下文中一共展示了Seq.Select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NormalMethod
private JST.FunctionExpression NormalMethod(CST.CSTWriter trace)
{
var cstmethod = CST.CSTMethod.Translate(methEnv, nameSupply, trace);
var methCompEnv = MethodCompilerEnvironment.EnterMethod
(env, outerNameSupply, nameSupply, rootId, assemblyId, typeDefinitionId, cstmethod.CompEnv, parent.TypeTrace);
var simpCtxt = new CST.SimplifierContext(methCompEnv, nameSupply, this, trace);
cstmethod = cstmethod.Simplify(simpCtxt);
if (trace != null)
trace.Trace("After simplification of intermediate representation", w2 => cstmethod.Append(w2));
var usage = cstmethod.Body.Usage(methCompEnv);
// Bind all type and value parameters
var parameters = new Seq<JST.Identifier>();
var body = new Seq<JST.Statement>();
foreach (var id in methCompEnv.TypeBoundTypeParameterIds)
parameters.Add(id);
foreach (var id in methCompEnv.MethodBoundTypeParameterIds)
parameters.Add(id);
var delta = env.InteropManager.IsFactory(methCompEnv.Assembly, methCompEnv.Type, methCompEnv.Method) ? 1 : 0;
for (var i = delta; i < methCompEnv.Method.Arity; i++)
{
var id = methCompEnv.ValueParameterIds[i];
if (i == 0 && !methCompEnv.Method.IsStatic && methCompEnv.Type.Arity == 0)
{
// Only instance methods of first-kinded types use 'this' for their first argument
if (usage.Variables.ContainsKey(id))
body.Add(JST.Statement.Var(id, new JST.ThisExpression()));
}
else
parameters.Add(id);
}
// Introduce the top level bindings based on usage
methCompEnv.BindUsage(body, usage);
// Introduce shared assembly/type/pointer bindings based on usage
if (env.DebugMode)
body.Add(new JST.CommentStatement("Locals"));
var uninit = new Seq<JST.Identifier>();
foreach (var kv in usage.Variables)
{
var v = methCompEnv.Variable(kv.Key);
if (v.ArgLocal == CST.ArgLocal.Local)
{
if (methCompEnv.Method.IsInitLocals && v.IsInit)
body.Add
(JST.Statement.Var(v.Id, env.JSTHelpers.DefaultExpressionForType(methCompEnv, v.Type)));
else
uninit.Add(v.Id);
}
}
if (uninit.Count > 0)
body.Add(new JST.VariableStatement(uninit.Select(id => new JST.VariableDeclaration(id)).ToSeq()));
// Translate body to JavaScript statements/expressions
foreach (var s in cstmethod.Body.Body)
TranslateStatement(methCompEnv, body, s);
var func = new JST.FunctionExpression(methCompEnv.MethodId, parameters, new JST.Statements(body));
if (trace != null)
trace.Trace
("After translation to JavaScript",
w =>
{
func.Append(w);
w.EndLine();
});
return func;
}