本文整理汇总了C#中ReadOnlyCollection类的典型用法代码示例。如果您正苦于以下问题:C# ReadOnlyCollection类的具体用法?C# ReadOnlyCollection怎么用?C# ReadOnlyCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReadOnlyCollection类属于命名空间,在下文中一共展示了ReadOnlyCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ForCSharpStatement
internal ForCSharpStatement(ReadOnlyCollection<ParameterExpression> variables, ReadOnlyCollection<Expression> initializers, Expression test, ReadOnlyCollection<Expression> iterators, Expression body, LabelTarget breakLabel, LabelTarget continueLabel)
: base(test, body, breakLabel, continueLabel)
{
Variables = variables;
Initializers = initializers;
Iterators = iterators;
}
示例2: VisitParameterExpressionList
protected virtual ReadOnlyCollection<ParameterExpression> VisitParameterExpressionList(ReadOnlyCollection<ParameterExpression> original)
{
List<ParameterExpression> list = null;
for (int i = 0, n = original.Count; i < n; i++)
{
ParameterExpression p = (ParameterExpression) this.Visit(original[i]);
if (list != null)
{
list.Add(p);
}
else if (p != original[i])
{
list = new List<ParameterExpression>(n);
for (int j = 0; j < i; j++)
{
list.Add(original[j]);
}
list.Add(p);
}
}
if (list != null)
{
return list.AsReadOnly();
}
return original;
}
示例3: EnumDefinition
/// <summary>
/// Initializes a new instance of the EnumDefinition class
/// Populates this object with information extracted from the XML
/// </summary>
/// <param name="theNode">XML node describing the Enum object</param>
/// <param name="manager">The data dictionary manager constructing this type.</param>
public EnumDefinition(XElement theNode, DictionaryManager manager)
: base(theNode, TypeId.EnumType)
{
// ByteSize may be set either directly as an integer or by inference from the Type field.
// If no Type field is present then the type is assumed to be 'int'
if (theNode.Element("ByteSize") != null)
{
SetByteSize(theNode.Element("ByteSize").Value);
}
else
{
string baseTypeName = theNode.Element("Type") != null ? theNode.Element("Type").Value : "int";
BaseType = manager.GetElementType(baseTypeName);
BaseType = DictionaryManager.DereferenceTypeDef(BaseType);
FixedSizeBytes = BaseType.FixedSizeBytes.Value;
}
// Common properties are parsed by the base class.
// Remaining properties are the Name/Value Literal elements
List<LiteralDefinition> theLiterals = new List<LiteralDefinition>();
foreach (var literalNode in theNode.Elements("Literal"))
{
theLiterals.Add(new LiteralDefinition(literalNode));
}
m_Literals = new ReadOnlyCollection<LiteralDefinition>(theLiterals);
// Check the name. If it's null then make one up
if (theNode.Element("Name") == null)
{
Name = String.Format("Enum_{0}", Ref);
}
}
示例4: PatternMatchRuleProcessor
private PatternMatchRuleProcessor(ReadOnlyCollection<PatternMatchRule> rules)
{
Debug.Assert(rules.Count() != 0, "At least one PatternMatchRule is required");
Debug.Assert(rules.Where(r => r == null).Count() == 0, "Individual PatternMatchRules must not be null");
ruleSet = rules;
}
示例5: CollectionContainsResults
//допилить!!!!!!!!!!!!!
/// <summary>
/// Проверяет содержат ли элементы коллекции текст, который задается во втором параметре через запятую по порядку
/// </summary>
/// <param name="elements"></param>
/// <param name="results"></param>
/// <returns></returns>
protected bool CollectionContainsResults(ReadOnlyCollection<IWebElement> elements, string results)
{
bool containt = true;
if (elements.Count > 1)
{
char[] separators = new char[elements.Count];
for (int i = 0; i < elements.Count; i++)
{
separators[i] = ',';
}
string[] res = results.Split(separators);
for (int i = 0; i < elements.Count; i++)
{
if (!elements[i].Text.Contains(res[i]))
{
containt = false;
}
}
}
else if (elements.Count == 1)
{
if (elements[0].Text.Contains(results))
{
containt = true;
}
}
else
{
Assert.Fail("There is no elements");
}
return containt;
}
示例6: ExternalRequirements
internal ExternalRequirements(Binding context,
IEnumerable<Expression> links)
: base(context, null, null)
{
Guard.NotNull(links, "links");
Links = new ReadOnlyCollection<Expression>(new List<Expression>(links));
}
示例7: MemberListBinding
internal MemberListBinding(MemberInfo member, ReadOnlyCollection<ElementInit> initializers)
#pragma warning disable 618
: base(MemberBindingType.ListBinding, member)
{
#pragma warning restore 618
Initializers = initializers;
}
示例8: Make
internal static NewArrayExpression Make(ExpressionType nodeType, Type type, ReadOnlyCollection<Expression> expressions) {
if (nodeType == ExpressionType.NewArrayInit) {
return new NewArrayInitExpression(type, expressions);
} else {
return new NewArrayBoundsExpression(type, expressions);
}
}
示例9: ScaleoutStreamManager
public ScaleoutStreamManager(Func<int, IList<Message>, Task> send,
Action<int, ulong, ScaleoutMessage> receive,
int streamCount,
TraceSource trace,
IPerformanceCounterManager performanceCounters,
ScaleoutConfiguration configuration)
{
if (configuration.QueueBehavior != QueuingBehavior.Disabled && configuration.MaxQueueLength == 0)
{
throw new InvalidOperationException(Resources.Error_ScaleoutQueuingConfig);
}
_streams = new ScaleoutStream[streamCount];
_send = send;
_receive = receive;
var receiveMapping = new ScaleoutMappingStore[streamCount];
performanceCounters.ScaleoutStreamCountTotal.RawValue = streamCount;
performanceCounters.ScaleoutStreamCountBuffering.RawValue = streamCount;
performanceCounters.ScaleoutStreamCountOpen.RawValue = 0;
for (int i = 0; i < streamCount; i++)
{
_streams[i] = new ScaleoutStream(trace, "Stream(" + i + ")", configuration.QueueBehavior, configuration.MaxQueueLength, performanceCounters);
receiveMapping[i] = new ScaleoutMappingStore();
}
Streams = new ReadOnlyCollection<ScaleoutMappingStore>(receiveMapping);
}
示例10: CartToShim
public CartToShim(int cartId, int userId)
{
CartId = cartId;
UserId = userId;
CreateDateTime = DateTime.Now;
CartItems = new ReadOnlyCollection<CartItem>(_cartItems);
}
示例11: SwitchExpression
internal SwitchExpression(Type type, Expression switchValue, Expression defaultBody, MethodInfo comparison, ReadOnlyCollection<SwitchCase> cases) {
_type = type;
_switchValue = switchValue;
_defaultBody = defaultBody;
_comparison = comparison;
_cases = cases;
}
示例12: MakeCallSiteDelegate
/// <summary>
/// Finds a delegate type for a CallSite using the types in the ReadOnlyCollection of Expression.
///
/// We take the read-only collection of Expression explicitly to avoid allocating memory (an array
/// of types) on lookup of delegate types.
/// </summary>
internal static Type MakeCallSiteDelegate(ReadOnlyCollection<Expression> types, Type returnType)
{
lock (_DelegateCache)
{
TypeInfo curTypeInfo = _DelegateCache;
// CallSite
curTypeInfo = NextTypeInfo(typeof(CallSite), curTypeInfo);
// arguments
for (int i = 0; i < types.Count; i++)
{
curTypeInfo = NextTypeInfo(types[i].Type, curTypeInfo);
}
// return type
curTypeInfo = NextTypeInfo(returnType, curTypeInfo);
// see if we have the delegate already
if (curTypeInfo.DelegateType == null)
{
curTypeInfo.MakeDelegateType(returnType, types);
}
return curTypeInfo.DelegateType;
}
}
示例13: AlloyOutliningTaggerWalker
private AlloyOutliningTaggerWalker(ITreeNodeStream input, ReadOnlyCollection<IToken> tokens, AlloyOutliningTaggerProvider provider, ITextSnapshot snapshot)
: base(input, snapshot, provider.OutputWindowService)
{
_tokens = tokens;
_provider = provider;
_snapshot = snapshot;
}
示例14: UnconditionalPolicy
public UnconditionalPolicy(ReadOnlyCollection<ClaimSet> issuances, DateTime expirationTime)
{
if (issuances == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("issuances");
Initialize(ClaimSet.System, null, issuances, expirationTime);
}
示例15: SimpleCallHelper
/// <summary>
/// The helper to create the AST method call node. Will add conversions (Utils.Convert)
/// to parameters and instance if necessary.
/// </summary>
public static MethodCallExpression SimpleCallHelper(Expression instance, MethodInfo method, params Expression[] arguments) {
ContractUtils.RequiresNotNull(method, "method");
ContractUtils.Requires(instance != null ^ method.IsStatic, "instance");
ContractUtils.RequiresNotNullItems(arguments, "arguments");
ParameterInfo[] parameters = method.GetParameters();
ContractUtils.Requires(arguments.Length == parameters.Length, "arguments", "Incorrect number of arguments");
if (instance != null) {
instance = Convert(instance, method.DeclaringType);
}
Expression[] convertedArguments = ArgumentConvertHelper(arguments, parameters);
ReadOnlyCollection<Expression> finalArgs;
if (convertedArguments == arguments) {
// we didn't convert anything, just convert the users original
// array to a readonly collection.
finalArgs = convertedArguments.ToReadOnly();
} else {
// we already copied the array so just stick it in a readonly collection.
finalArgs = new ReadOnlyCollection<Expression>(convertedArguments);
}
// the arguments are now all correct, avoid re-validating the call parameters and
// directly create the expression.
return Expression.Call(instance, method, finalArgs);
}