本文整理汇总了C#中ReadOnlyCollection.AddFirst方法的典型用法代码示例。如果您正苦于以下问题:C# ReadOnlyCollection.AddFirst方法的具体用法?C# ReadOnlyCollection.AddFirst怎么用?C# ReadOnlyCollection.AddFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReadOnlyCollection
的用法示例。
在下文中一共展示了ReadOnlyCollection.AddFirst方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HoistedLocals
internal HoistedLocals(HoistedLocals parent, ReadOnlyCollection<ParameterExpression> vars)
{
if (parent != null)
{
vars = new TrueReadOnlyCollection<ParameterExpression>(vars.AddFirst<ParameterExpression>(parent.SelfVariable));
}
Dictionary<Expression, int> dict = new Dictionary<Expression, int>(vars.Count);
for (int i = 0; i < vars.Count; i++)
{
dict.Add(vars[i], i);
}
this.SelfVariable = Expression.Variable(typeof(object[]), null);
this.Parent = parent;
this.Variables = vars;
this.Indexes = new ReadOnlyDictionary<Expression, int>(dict);
}
示例2: HoistedLocals
internal HoistedLocals(HoistedLocals parent, ReadOnlyCollection<ParameterExpression> vars) {
if (parent != null) {
// Add the parent locals array as the 0th element in the array
vars = new TrueReadOnlyCollection<ParameterExpression>(vars.AddFirst(parent.SelfVariable));
}
Dictionary<Expression, int> indexes = new Dictionary<Expression, int>(vars.Count);
for (int i = 0; i < vars.Count; i++) {
indexes.Add(vars[i], i);
}
SelfVariable = Expression.Variable(typeof(object[]), null);
Parent = parent;
Variables = vars;
Indexes = new ReadOnlyDictionary<Expression, int>(indexes);
}