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
- AssemblyHash.cs
- GiveFeedbackEventArgs.cs
- ICspAsymmetricAlgorithm.cs
- XmlSchemaDocumentation.cs
- AppDomainAttributes.cs
- CodeArrayCreateExpression.cs
- EntityDescriptor.cs
- MimeReflector.cs
- DynamicILGenerator.cs
- FeatureAttribute.cs
- StringDictionaryEditor.cs
- NodeLabelEditEvent.cs
- GridViewUpdateEventArgs.cs
- SQLMembershipProvider.cs
- Int64AnimationBase.cs
- ComponentRenameEvent.cs
- MenuTracker.cs
- HttpConfigurationSystem.cs
- DataGridColumnCollection.cs
- DrawingAttributeSerializer.cs
- WebPartCatalogCloseVerb.cs
- FixedBufferAttribute.cs
- XPathNodeIterator.cs
- MetadataArtifactLoader.cs
- ListView.cs
- HandlerBase.cs
- XmlCharType.cs
- XamlToRtfWriter.cs
- ObjectStateManager.cs
- XamlClipboardData.cs
- LocalizationParserHooks.cs
- sqlinternaltransaction.cs
- Property.cs
- IRCollection.cs
- SnapshotChangeTrackingStrategy.cs
- Empty.cs
- Base64Encoding.cs
- StrongTypingException.cs
- NumericUpDownAccelerationCollection.cs
- Label.cs
- DefaultValueConverter.cs
- MissingManifestResourceException.cs
- PointLightBase.cs
- StylusEventArgs.cs
- InvalidProgramException.cs
- FileReservationCollection.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- Italic.cs
- InheritanceRules.cs
- HttpMethodConstraint.cs
- KnownAssemblyEntry.cs
- Soap.cs
- GridItemProviderWrapper.cs
- Process.cs
- PermissionSet.cs
- ReadOnlyDataSourceView.cs
- ContainerVisual.cs
- ProcessThreadCollection.cs
- StorageSetMapping.cs
- RawUIStateInputReport.cs
- EventProviderWriter.cs
- ToolBarDesigner.cs
- MSAANativeProvider.cs
- ImageSource.cs
- SqlDataSource.cs
- MailWriter.cs
- TargetPerspective.cs
- ConfigPathUtility.cs
- Storyboard.cs
- OutputCacheSection.cs
- StreamingContext.cs
- DrawingImage.cs
- AuthorizationRuleCollection.cs
- NamedPermissionSet.cs
- OutKeywords.cs
- JournalNavigationScope.cs
- ObjectViewEntityCollectionData.cs
- WebPartDeleteVerb.cs
- DeviceContexts.cs
- WindowHideOrCloseTracker.cs
- ComplexObject.cs
- ServicesUtilities.cs
- VerificationException.cs
- ColorPalette.cs
- log.cs
- SafeLocalAllocation.cs
- PackageFilter.cs
- ContextInformation.cs
- ExtensionSimplifierMarkupObject.cs
- ReferenceEqualityComparer.cs
- DynamicPropertyReader.cs
- Constraint.cs
- DurableOperationAttribute.cs
- ForeignKeyConstraint.cs
- NotificationContext.cs
- WebPageTraceListener.cs
- StatusBar.cs
- Propagator.JoinPropagator.cs
- PropertyGridCommands.cs
- TreeView.cs