Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / 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); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ //// 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); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ModelPropertyImpl.cs
- EventHandlersDesigner.cs
- Grant.cs
- CollectionType.cs
- Repeater.cs
- IdentityReference.cs
- StreamSecurityUpgradeAcceptor.cs
- ManipulationDevice.cs
- PersonalizableTypeEntry.cs
- ProfileEventArgs.cs
- DllNotFoundException.cs
- ContainerFilterService.cs
- BuildManager.cs
- CmsInterop.cs
- XPathSingletonIterator.cs
- ExpressionVisitor.cs
- CompilationRelaxations.cs
- Helpers.cs
- CodeValidator.cs
- SqlCharStream.cs
- TransactionBridgeSection.cs
- WinFormsSecurity.cs
- AttributeProviderAttribute.cs
- InternalMappingException.cs
- ElementNotEnabledException.cs
- ConnectionsZone.cs
- LayoutEngine.cs
- ResourceDescriptionAttribute.cs
- CodeBlockBuilder.cs
- LateBoundBitmapDecoder.cs
- DataTableMappingCollection.cs
- ProtocolElement.cs
- ReachUIElementCollectionSerializer.cs
- FileInfo.cs
- CodeValidator.cs
- FileDialogCustomPlace.cs
- StructuralObject.cs
- ImportContext.cs
- QilInvoke.cs
- TextEditorMouse.cs
- RoutedCommand.cs
- ObjectSpanRewriter.cs
- WebPartConnectionsDisconnectVerb.cs
- SettingsPropertyCollection.cs
- ViewBase.cs
- BaseHashHelper.cs
- XPathScanner.cs
- ExtentCqlBlock.cs
- ParameterInfo.cs
- ReflectionHelper.cs
- RegexCapture.cs
- DefaultDialogButtons.cs
- BaseDataList.cs
- BinaryReader.cs
- ISAPIApplicationHost.cs
- LocalizationCodeDomSerializer.cs
- TableLayoutRowStyleCollection.cs
- VectorAnimationUsingKeyFrames.cs
- ConfigurationSectionCollection.cs
- DataColumnPropertyDescriptor.cs
- UnsafeNativeMethods.cs
- Geometry3D.cs
- listitem.cs
- SqlInternalConnectionSmi.cs
- PermissionSet.cs
- JsonReader.cs
- IndexExpression.cs
- MessageDecoder.cs
- ClientTargetCollection.cs
- XPathNavigatorKeyComparer.cs
- IBuiltInEvidence.cs
- BinaryObjectReader.cs
- AttributeCollection.cs
- BookmarkResumptionRecord.cs
- AssociatedControlConverter.cs
- DateTimeConverter2.cs
- externdll.cs
- configsystem.cs
- ImportContext.cs
- PerformanceCounterNameAttribute.cs
- LinqDataSourceSelectEventArgs.cs
- ConstraintCollection.cs
- WebPartZone.cs
- DataControlLinkButton.cs
- ClientUtils.cs
- LinearQuaternionKeyFrame.cs
- RouteItem.cs
- Math.cs
- ChangeToolStripParentVerb.cs
- MSHTMLHostUtil.cs
- PropertyReference.cs
- ASCIIEncoding.cs
- PenThreadPool.cs
- XmlNode.cs
- Help.cs
- TextPattern.cs
- ItemsPresenter.cs
- SqlDataSourceConfigureSelectPanel.cs
- TextRange.cs
- TextFindEngine.cs