Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ //// 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
- DeploymentExceptionMapper.cs
- NumberSubstitution.cs
- BaseCollection.cs
- HwndStylusInputProvider.cs
- SchemaConstraints.cs
- ExpressionConverter.cs
- VBIdentifierName.cs
- PropertyStore.cs
- XmlNodeList.cs
- TextRunCacheImp.cs
- SourceInterpreter.cs
- JobCollate.cs
- ListControlConvertEventArgs.cs
- AuthenticateEventArgs.cs
- ObjectDataSourceMethodEditor.cs
- SessionStateContainer.cs
- TextBoxLine.cs
- ComponentEvent.cs
- GridToolTip.cs
- XsltInput.cs
- SyntaxCheck.cs
- CodeTypeReference.cs
- MemberBinding.cs
- GridViewColumnCollectionChangedEventArgs.cs
- OleDbInfoMessageEvent.cs
- ProvidePropertyAttribute.cs
- BitmapEffectState.cs
- DataBindingCollection.cs
- Terminate.cs
- WebZoneDesigner.cs
- CacheEntry.cs
- MouseEvent.cs
- CodeTypeDelegate.cs
- UserNamePasswordValidationMode.cs
- Addressing.cs
- RenderingEventArgs.cs
- Misc.cs
- XPathNodePointer.cs
- InputEventArgs.cs
- ComProxy.cs
- ExpandCollapsePattern.cs
- DataGridViewAdvancedBorderStyle.cs
- Column.cs
- AuthenticationException.cs
- StylusPointPropertyInfoDefaults.cs
- FieldBuilder.cs
- EdmComplexPropertyAttribute.cs
- TextBoxDesigner.cs
- StreamingContext.cs
- NCryptSafeHandles.cs
- ClientConfigurationSystem.cs
- InstanceKeyView.cs
- AdjustableArrowCap.cs
- ObfuscationAttribute.cs
- OpCodes.cs
- StartFileNameEditor.cs
- Border.cs
- Win32Native.cs
- SSmlParser.cs
- HashHelper.cs
- AttachedPropertiesService.cs
- BaseServiceProvider.cs
- ConfigXmlSignificantWhitespace.cs
- UpdateRecord.cs
- XmlTextAttribute.cs
- ExtensionSimplifierMarkupObject.cs
- LoadMessageLogger.cs
- SingleConverter.cs
- SchemaImporterExtension.cs
- ServerIdentity.cs
- ClickablePoint.cs
- EntitySetBase.cs
- Int64AnimationBase.cs
- WebFormDesignerActionService.cs
- ConfigsHelper.cs
- SqlTypeSystemProvider.cs
- AuthStoreRoleProvider.cs
- ColumnPropertiesGroup.cs
- FtpWebResponse.cs
- ComPersistableTypeElement.cs
- XmlException.cs
- Win32PrintDialog.cs
- QueryCacheEntry.cs
- ListViewGroupConverter.cs
- InterleavedZipPartStream.cs
- SignatureToken.cs
- RequestSecurityTokenResponseCollection.cs
- XmlDictionary.cs
- ConstrainedDataObject.cs
- PrintDialog.cs
- WindowsScroll.cs
- StrongNamePublicKeyBlob.cs
- CompareValidator.cs
- MessageDecoder.cs
- XPathScanner.cs
- DefaultPrintController.cs
- SQLInt64.cs
- MultiSelectRootGridEntry.cs
- BuildManager.cs
- ZipIOLocalFileBlock.cs