Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebControls / RoleGroupCollection.cs / 1 / RoleGroupCollection.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.WebControls {
using System.Collections;
using System.ComponentModel;
using System.Security.Permissions;
using System.Security.Principal;
using System.Drawing.Design;
using System.Web.Security;
///
/// Collection of RoleGroups.
///
[
Editor("System.Web.UI.Design.WebControls.RoleGroupCollectionEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor))
]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class RoleGroupCollection : CollectionBase {
public RoleGroup this[int index] {
get {
return (RoleGroup)List[index];
}
}
public void Add(RoleGroup group) {
List.Add(group);
}
public void CopyTo(RoleGroup[] array, int index) {
List.CopyTo(array, index);
}
public bool Contains(RoleGroup group) {
return List.Contains(group);
}
///
/// The first RoleGroup that contains the user.
///
public RoleGroup GetMatchingRoleGroup(IPrincipal user) {
int index = GetMatchingRoleGroupInternal(user);
if (index != -1) {
return this[index];
}
return null;
}
///
/// Index of the first RoleGroup that contains the user. Internal because called from LoginView.
///
internal int GetMatchingRoleGroupInternal(IPrincipal user) {
if (user == null) {
throw new ArgumentNullException("user");
}
int i = 0;
foreach (RoleGroup group in this) {
if (group.ContainsUser(user)) {
return i;
}
i++;
}
return -1;
}
public int IndexOf(RoleGroup group) {
return List.IndexOf(group);
}
public void Insert(int index, RoleGroup group) {
List.Insert(index, group);
}
protected override void OnValidate(object value) {
base.OnValidate(value);
if (!(value is RoleGroup)) {
throw new ArgumentException(SR.GetString(SR.RoleGroupCollection_InvalidType), "value");
}
}
public void Remove(RoleGroup group) {
int index = IndexOf(group);
if (index >= 0) {
List.RemoveAt(index);
}
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AsyncOperationLifetimeManager.cs
- SqlNamer.cs
- GorillaCodec.cs
- TextPattern.cs
- MenuCommand.cs
- ObjectParameter.cs
- TreeViewTemplateSelector.cs
- ResolvedKeyFrameEntry.cs
- FixedHighlight.cs
- MessageQueueEnumerator.cs
- SqlBooleanMismatchVisitor.cs
- EncodingNLS.cs
- BinaryMethodMessage.cs
- ActiveXHost.cs
- HyperLinkStyle.cs
- Label.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- EntityDataSourceContainerNameItem.cs
- GPPOINTF.cs
- RegexTree.cs
- ContentPathSegment.cs
- VirtualDirectoryMapping.cs
- FieldCollectionEditor.cs
- VersionPair.cs
- XmlDataCollection.cs
- GridViewPageEventArgs.cs
- CssClassPropertyAttribute.cs
- Span.cs
- WorkflowTraceTransfer.cs
- RelationshipConverter.cs
- StylusPointPropertyInfo.cs
- StringFormat.cs
- QilTargetType.cs
- StrongTypingException.cs
- ContextQuery.cs
- ControlValuePropertyAttribute.cs
- Marshal.cs
- TopClause.cs
- TextFindEngine.cs
- OracleNumber.cs
- ContentElement.cs
- Property.cs
- DesignTimeType.cs
- LicenseContext.cs
- WebRequest.cs
- EntityParameterCollection.cs
- SourceChangedEventArgs.cs
- DecimalAnimationUsingKeyFrames.cs
- MetadataArtifactLoader.cs
- GraphicsPathIterator.cs
- _Rfc2616CacheValidators.cs
- ConstructorArgumentAttribute.cs
- DataSourceIDConverter.cs
- EntityDataReader.cs
- WebPartChrome.cs
- PropertyEmitter.cs
- VerticalAlignConverter.cs
- AssociationSetMetadata.cs
- CodeParameterDeclarationExpressionCollection.cs
- TabletDeviceInfo.cs
- HtmlImageAdapter.cs
- HyperLink.cs
- ItemTypeToolStripMenuItem.cs
- BitmapEffectDrawingContent.cs
- SqlRetyper.cs
- XmlNode.cs
- HttpCachePolicyElement.cs
- BamlRecordHelper.cs
- Internal.cs
- Buffer.cs
- EventLogEntryCollection.cs
- DataGridViewCell.cs
- Point3DCollection.cs
- XslTransform.cs
- InterleavedZipPartStream.cs
- MdImport.cs
- EntityViewGenerator.cs
- StandardOleMarshalObject.cs
- ExpandCollapsePattern.cs
- SqlDependency.cs
- HttpContextWrapper.cs
- SqlParameterCollection.cs
- ConnectionProviderAttribute.cs
- QueryCursorEventArgs.cs
- StorageRoot.cs
- xdrvalidator.cs
- SessionPageStatePersister.cs
- CallbackHandler.cs
- AudioFileOut.cs
- SelectionItemPattern.cs
- DataControlCommands.cs
- LifetimeServices.cs
- _Semaphore.cs
- SqlMethodAttribute.cs
- XPathParser.cs
- DataFieldEditor.cs
- TypeUnloadedException.cs
- HttpApplicationStateWrapper.cs
- AsymmetricSignatureDeformatter.cs
- Style.cs