本文整理汇总了C#中IList.AsReadOnly方法的典型用法代码示例。如果您正苦于以下问题:C# IList.AsReadOnly方法的具体用法?C# IList.AsReadOnly怎么用?C# IList.AsReadOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IList
的用法示例。
在下文中一共展示了IList.AsReadOnly方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TransformationStepRecorder
public TransformationStepRecorder()
{
var steps = new List<ITransformationStep>(16);
this.steps = steps;
this.readonlySteps = steps.AsReadOnly();
}
示例2: AstMissingMethod
public AstMissingMethod(string name, IList<IAstTypeReference> parameterTypes)
{
Argument.RequireNotNullAndNotEmpty("name", name);
Argument.RequireNotNullNotEmptyAndNotContainsNull("parameterTypes", parameterTypes);
this.Name = name;
this.ParameterTypes = parameterTypes.AsReadOnly();
}
示例3: TermExpression
public TermExpression(IList<TermExpression> terms)
{
if (terms == null || terms.Count == 0)
throw new CqlLinqException("Empty lists are not allowed");
_type = typeof(IList<>).MakeGenericType(terms[0].Type);
_terms = terms.AsReadOnly();
_termType = CqlExpressionType.List;
}
示例4: BlameResult
public BlameResult(Uri webRootUrl, ReadOnlyCollection<Block> blocks, IList<Line> lines, Dictionary<string, Commit> commits)
{
m_webRootUrl = webRootUrl;
m_blocks = blocks;
m_lines = lines;
m_linesReadOnly = m_lines.AsReadOnly();
m_commits = commits;
m_commitsReadOnly = m_commits.Values.ToList().AsReadOnly();
}
示例5: GrantViewModel
public GrantViewModel(
string albumID,
HashSet<IUserGroup> grantedUserGroups,
IList<UserGroupViewModel> allUserGroups
)
{
this.AlbumID = albumID;
this.grantedUserGroups = grantedUserGroups;
this.AllUserGroups = allUserGroups.AsReadOnly();
}
示例6: SetData
internal void SetData(IList<Block> blocks, IList<Line> lines, Dictionary<string, Commit> commits)
{
m_blocks = blocks.AsReadOnly();
m_lines = lines;
m_linesReadOnly = lines.AsReadOnly();
m_commits = commits;
m_commitsReadOnly = m_commits.Values.ToList().AsReadOnly();
RaisePropertyChanged(null);
}
示例7: IpV4OptionTimestampAndAddress
/// <summary>
/// Create the option by giving it all the data.
/// </summary>
/// <param name="timestampType">The timestamp option type.</param>
/// <param name="overflow">The number of IP modules that cannot register timestamps due to lack of space. Maximum value is 15.</param>
/// <param name="pointedIndex">The index in the timestamp that points to the for next timestamp.</param>
/// <param name="timedRoute">The pairs of addresses and timestamps where each timestamp time passed since midnight UT.</param>
public IpV4OptionTimestampAndAddress(IpV4OptionTimestampType timestampType, byte overflow, byte pointedIndex, IList<IpV4OptionTimedAddress> timedRoute)
: base(timestampType, overflow, pointedIndex)
{
if (timestampType != IpV4OptionTimestampType.AddressAndTimestamp &&
timestampType != IpV4OptionTimestampType.AddressPrespecified)
{
throw new ArgumentException("Illegal timestamp type " + timestampType, "timestampType");
}
_addressesAndTimestamps = timedRoute.AsReadOnly();
}
示例8: GalleryViewModel
public GalleryViewModel(
AlbumViewModel currentUserAlbum,
IList<AlbumViewModel> otherPeopleAlbums,
AlbumListViewModel standardAlbums,
AlbumViewModel selected
)
{
this.CurrentUserAlbum = currentUserAlbum;
this.OtherPeopleAlbums = otherPeopleAlbums.AsReadOnly();
this.StandardAlbums = standardAlbums;
this.Selected = selected;
}
示例9: AstGenericMethodWithTypeArguments
public AstGenericMethodWithTypeArguments(IAstMethodReference actual, IList<IAstTypeReference> typeArguments, GenericTypeHelper genericHelper)
{
Argument.RequireNotNull("actual", actual);
Argument.RequireNotNull("typeArguments", typeArguments);
this.Actual = actual;
this.GenericArgumentTypes = typeArguments.AsReadOnly();
var genericParameterTypes = actual.GetGenericParameterTypes().ToArray();
this.ParameterTypes = actual.ParameterTypes.Select(t => ApplyArgumentTypes(genericHelper, t, genericParameterTypes)).ToArray().AsReadOnly();
this.ReturnType = ApplyArgumentTypes(genericHelper, actual.ReturnType, genericParameterTypes);
}
示例10: SelectStatementExpression
public SelectStatementExpression(Type type, SelectClauseExpression selectClause, string tableName,
IList<RelationExpression> whereClause, IList<OrderingExpression> orderBy,
int? limit, bool allowFiltering)
{
if (type == null)
throw new ArgumentNullException("type");
if (selectClause == null)
throw new ArgumentNullException("selectClause");
if (tableName == null)
throw new ArgumentNullException("tableName");
_type = type;
_selectClause = selectClause;
_tableName = tableName;
_whereClause = whereClause.AsReadOnly();
_orderBy = orderBy.AsReadOnly();
_limit = limit;
_allowFiltering = allowFiltering;
}
示例11: IpV4OptionTimestampOnly
/// <summary>
/// Create the option by giving it all the data.
/// </summary>
/// <param name="overflow">The number of IP modules that cannot register timestamps due to lack of space. Maximum value is 15.</param>
/// <param name="pointedIndex">The index in the timestamp that points to the for next timestamp.</param>
/// <param name="timestamps">The timestamps as time passed since midnight UT.</param>
public IpV4OptionTimestampOnly(byte overflow, byte pointedIndex, IList<IpV4TimeOfDay> timestamps)
: base(IpV4OptionTimestampType.TimestampOnly, overflow, pointedIndex)
{
_timestamps = timestamps.AsReadOnly();
}
示例12: GetEntryNames
private static IList<IList<string>> GetEntryNames( XmlNode sectionsNode, XmlNode templatesNode )
{
int sectionCount = Int32.Parse( sectionsNode.Attributes["count"].InnerText );
IList<IList<string>> result = new IList<string>[sectionCount];
for ( int i = 0; i < sectionCount; i++ )
{
XmlNode currentNode = sectionsNode.SelectSingleNode( string.Format( "Section[@value='{0}']", i ) );
int currentCount = Int32.Parse( currentNode.Attributes["entries"].InnerText );
XmlNode emptyNode = currentNode.Attributes["empty"];
bool empty = emptyNode != null && Boolean.Parse( emptyNode.InnerText );
if ( empty )
{
result[i] = new string[currentCount].AsReadOnly();
}
else
{
string[] currentSection = new string[currentCount];
foreach ( XmlNode entryNode in currentNode.SelectNodes( "entry" ) )
{
int index = Int32.Parse( entryNode.Attributes["value"].InnerText );
currentSection[index] = entryNode.Attributes["name"].InnerText;
}
foreach ( XmlNode includeNode in currentNode.SelectNodes( "include" ) )
{
XmlNode included = templatesNode.SelectSingleNode( includeNode.Attributes["name"].InnerText );
int start = Int32.Parse( includeNode.Attributes["start"].InnerText );
int end = Int32.Parse( includeNode.Attributes["end"].InnerText );
int offset = Int32.Parse( includeNode.Attributes["offset"].InnerText );
for ( int j = start; j <= end; j++ )
{
currentSection[j + offset] = included.SelectSingleNode( string.Format( "entry[@value='{0}']", j ) ).Attributes["name"].InnerText;
}
}
result[i] = currentSection.AsReadOnly();
}
}
return result.AsReadOnly();
}
示例13: GetDisallowedEntries
private static void GetDisallowedEntries( XmlNode node, int numSections, out IList<IList<int>> disallowed, out IList<IDictionary<int,string>> staticEntries )
{
IList<IList<int>> result = new IList<int>[numSections];
IList<IDictionary<int, string>> ourStatic = new IDictionary<int, string>[numSections];
XmlNode disallowedNode = node.SelectSingleNode( "DisallowedEntries" );
if ( disallowedNode != null )
{
foreach ( XmlNode node2 in disallowedNode.SelectNodes( "Section" ) )
{
int sec = Int32.Parse( node2.Attributes["value"].InnerText );
List<int> ourResult = new List<int>();
Dictionary<int, string> ourDict = new Dictionary<int, string>();
foreach ( XmlNode ent in node2.SelectNodes( "entry" ) )
{
int idx = Int32.Parse(ent.InnerText);
ourResult.Add( idx);
XmlAttribute stat = ent.Attributes["staticValue"];
if ( stat != null )
{
ourDict[idx] = stat.InnerText;
}
else
{
ourDict[idx] = string.Empty;
}
}
result[sec] = ourResult.AsReadOnly();
ourStatic[sec] = new ReadOnlyDictionary<int, string>( ourDict );
}
}
for ( int i = 0; i < result.Count; i++ )
{
if ( result[i] == null )
{
result[i] = new int[0].AsReadOnly();
}
if ( ourStatic[i] == null )
{
ourStatic[i] = new ReadOnlyDictionary<int, string>( new Dictionary<int, string>( 0 ) );
}
}
disallowed = result.AsReadOnly();
staticEntries = ourStatic.AsReadOnly();
}
示例14: DbExpressionSet
public DbExpressionSet(IList<Expression> expressions)
: base(DbExpressionType.Block,
expressions[expressions.Count - 1].Type)
{
_expressions = expressions.AsReadOnly();
}
示例15: IpV6MobilityOptionContextRequest
/// <summary>
/// Creates an instance from a list of requests.
/// </summary>
/// <param name="requests">The requests types and options.</param>
public IpV6MobilityOptionContextRequest(IList<IpV6MobilityOptionContextRequestEntry> requests)
: this(requests.AsReadOnly())
{
}