Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / RoleGroupCollection.cs / 1305376 / RoleGroupCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System.Collections; using System.ComponentModel; 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)) ] 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); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WorkflowQueue.cs
- SynchronizedDispatch.cs
- AppearanceEditorPart.cs
- ScaleTransform3D.cs
- MaterializeFromAtom.cs
- DbCommandTree.cs
- DbConnectionPoolGroupProviderInfo.cs
- PropertyDescriptorCollection.cs
- SubclassTypeValidator.cs
- X509SubjectKeyIdentifierClause.cs
- DATA_BLOB.cs
- OdbcInfoMessageEvent.cs
- Stroke2.cs
- SubMenuStyle.cs
- ListViewGroupItemCollection.cs
- WorkflowInstanceExtensionCollection.cs
- StreamSecurityUpgradeInitiatorAsyncResult.cs
- DecoderNLS.cs
- BackgroundFormatInfo.cs
- ScrollEventArgs.cs
- CustomLineCap.cs
- CompiledQueryCacheEntry.cs
- CheckBoxAutomationPeer.cs
- EmptyImpersonationContext.cs
- ReadOnlyAttribute.cs
- AsymmetricAlgorithm.cs
- FontFamilyConverter.cs
- RoleBoolean.cs
- XmlLanguageConverter.cs
- _BasicClient.cs
- BuildResultCache.cs
- WsdlImporterElement.cs
- TypeSystem.cs
- PerspectiveCamera.cs
- DataBindingExpressionBuilder.cs
- SafeCryptContextHandle.cs
- FeatureSupport.cs
- Stylesheet.cs
- TreeNodeCollection.cs
- externdll.cs
- XamlSerializerUtil.cs
- AutoResizedEvent.cs
- HotSpotCollection.cs
- NotificationContext.cs
- ErrorFormatter.cs
- TextServicesLoader.cs
- GZipStream.cs
- SafeNativeMethods.cs
- PerspectiveCamera.cs
- TimeSpanMinutesConverter.cs
- BrushConverter.cs
- ContextProperty.cs
- FixedSOMPageElement.cs
- InstanceCreationEditor.cs
- MenuEventArgs.cs
- XmlValueConverter.cs
- Stack.cs
- HwndHostAutomationPeer.cs
- ValueProviderWrapper.cs
- InvalidPrinterException.cs
- ProfilePropertySettings.cs
- ToolStripStatusLabel.cs
- DataGridTextBoxColumn.cs
- ProcessInfo.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- UnsafeNativeMethods.cs
- SqlHelper.cs
- Identifier.cs
- ContentDisposition.cs
- EventHandlersStore.cs
- SymDocumentType.cs
- WasHttpHandlersInstallComponent.cs
- UnauthorizedWebPart.cs
- DefaultShape.cs
- ArcSegment.cs
- MimeParameter.cs
- SafeArchiveContext.cs
- JavaScriptObjectDeserializer.cs
- StaticContext.cs
- SHA256.cs
- NamespaceEmitter.cs
- ConsumerConnectionPointCollection.cs
- ObjectComplexPropertyMapping.cs
- basemetadatamappingvisitor.cs
- ListControlDataBindingHandler.cs
- RNGCryptoServiceProvider.cs
- TextCompositionEventArgs.cs
- SqlWebEventProvider.cs
- WindowsTreeView.cs
- ColorDialog.cs
- PenLineCapValidation.cs
- SafeViewOfFileHandle.cs
- ClientProxyGenerator.cs
- SchemaCompiler.cs
- FlagsAttribute.cs
- JsonServiceDocumentSerializer.cs
- CompositeControl.cs
- CellNormalizer.cs
- OwnerDrawPropertyBag.cs
- SerializationHelper.cs