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
- XmlSerializer.cs
- WeakRefEnumerator.cs
- RowsCopiedEventArgs.cs
- DetailsViewDeletedEventArgs.cs
- SchemaMapping.cs
- InteropExecutor.cs
- OAVariantLib.cs
- ManagedWndProcTracker.cs
- AspNetSynchronizationContext.cs
- CallbackValidator.cs
- ETagAttribute.cs
- ViewGenerator.cs
- MessageQueueTransaction.cs
- DeleteBookmarkScope.cs
- DispatcherObject.cs
- TimeoutException.cs
- InkSerializer.cs
- _FixedSizeReader.cs
- MessageSecurityOverMsmqElement.cs
- ListItemsPage.cs
- ColumnResult.cs
- Formatter.cs
- SectionVisual.cs
- FontSource.cs
- EasingFunctionBase.cs
- HtmlImage.cs
- ComplexType.cs
- InternalResources.cs
- IItemContainerGenerator.cs
- HandlerBase.cs
- WorkflowInspectionServices.cs
- _RequestCacheProtocol.cs
- UrlPath.cs
- TextTrailingCharacterEllipsis.cs
- ManagedCodeMarkers.cs
- SystemKeyConverter.cs
- Message.cs
- ChannelServices.cs
- DockingAttribute.cs
- StringFormat.cs
- ItemChangedEventArgs.cs
- DependencyProperty.cs
- SmiConnection.cs
- CompilerCollection.cs
- XmlSchemaValidator.cs
- MemberAssignmentAnalysis.cs
- WindowsFormsEditorServiceHelper.cs
- XmlParser.cs
- XPathMultyIterator.cs
- UndoManager.cs
- HttpWriter.cs
- PinnedBufferMemoryStream.cs
- columnmapfactory.cs
- PointAnimation.cs
- CommonObjectSecurity.cs
- ApplicationFileCodeDomTreeGenerator.cs
- LabelDesigner.cs
- Base64Encoder.cs
- IPEndPointCollection.cs
- CharacterBufferReference.cs
- SplineKeyFrames.cs
- DataGridView.cs
- NameValuePermission.cs
- SessionEndingEventArgs.cs
- SplineKeyFrames.cs
- ScriptingProfileServiceSection.cs
- Scheduler.cs
- ResourceWriter.cs
- WebPartChrome.cs
- BufferedGraphicsContext.cs
- SimpleTypesSurrogate.cs
- DbMetaDataColumnNames.cs
- ChangePassword.cs
- UserPreferenceChangedEventArgs.cs
- LinkClickEvent.cs
- IdentifierService.cs
- TimeStampChecker.cs
- DataKey.cs
- SvcMapFile.cs
- CodeDelegateInvokeExpression.cs
- HiddenFieldDesigner.cs
- Menu.cs
- ToolStripDropDownClosingEventArgs.cs
- SecureStringHasher.cs
- _Semaphore.cs
- DetailsViewModeEventArgs.cs
- SystemDropShadowChrome.cs
- MsmqProcessProtocolHandler.cs
- _NtlmClient.cs
- TcpChannelFactory.cs
- SqlConnection.cs
- EditBehavior.cs
- ConnectionManagementElement.cs
- ConfigurationManagerInternalFactory.cs
- GetWinFXPath.cs
- StackSpiller.Temps.cs
- EditorZoneBase.cs
- SafeJobHandle.cs
- PermissionListSet.cs
- NonBatchDirectoryCompiler.cs