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
- DataBoundLiteralControl.cs
- RootBrowserWindowProxy.cs
- AsyncCompletedEventArgs.cs
- ListenDesigner.cs
- HandleCollector.cs
- Composition.cs
- ScheduleChanges.cs
- LicenseManager.cs
- SubMenuStyle.cs
- Vector.cs
- OleDbReferenceCollection.cs
- HttpWebRequest.cs
- DelegatingTypeDescriptionProvider.cs
- ReferencedCollectionType.cs
- DummyDataSource.cs
- DynamicRenderer.cs
- SafeNativeMethods.cs
- dbdatarecord.cs
- CommandLineParser.cs
- SqlCacheDependencySection.cs
- ParagraphVisual.cs
- JoinTreeNode.cs
- ToolStripDropDownClosedEventArgs.cs
- NullableDecimalSumAggregationOperator.cs
- FamilyMap.cs
- BinaryParser.cs
- BinaryMessageEncoder.cs
- Utilities.cs
- PasswordTextContainer.cs
- _DisconnectOverlappedAsyncResult.cs
- VScrollProperties.cs
- DocumentPageTextView.cs
- CheckBoxRenderer.cs
- Slider.cs
- FrameworkContentElement.cs
- WSSecureConversation.cs
- X500Name.cs
- EnumUnknown.cs
- Tuple.cs
- BinaryUtilClasses.cs
- AdornedElementPlaceholder.cs
- ReadOnlyNameValueCollection.cs
- XmlKeywords.cs
- SigningCredentials.cs
- Exceptions.cs
- DefaultPropertyAttribute.cs
- GraphicsPath.cs
- AxisAngleRotation3D.cs
- PrimaryKeyTypeConverter.cs
- MissingMemberException.cs
- SplitterCancelEvent.cs
- FormsIdentity.cs
- ColumnHeaderConverter.cs
- ListBoxItemAutomationPeer.cs
- DataGridViewComboBoxColumn.cs
- SingleObjectCollection.cs
- RequestCachePolicy.cs
- EmptyControlCollection.cs
- SafeViewOfFileHandle.cs
- BindingMAnagerBase.cs
- ZipIORawDataFileBlock.cs
- SqlConnectionManager.cs
- ListSortDescriptionCollection.cs
- ComplexLine.cs
- UICuesEvent.cs
- PerformanceCounterPermissionAttribute.cs
- FileEnumerator.cs
- DefaultPrintController.cs
- UTF7Encoding.cs
- PropertyGridEditorPart.cs
- FixedPosition.cs
- AffineTransform3D.cs
- LeafCellTreeNode.cs
- MatrixKeyFrameCollection.cs
- IgnoreFlushAndCloseStream.cs
- Selection.cs
- PrintDialog.cs
- DecimalStorage.cs
- NavigationWindowAutomationPeer.cs
- MaskInputRejectedEventArgs.cs
- ContentElement.cs
- PreloadedPackages.cs
- PublishLicense.cs
- ItemList.cs
- Context.cs
- HttpDebugHandler.cs
- UnsafeNativeMethods.cs
- SqlProviderServices.cs
- DbModificationCommandTree.cs
- EdmToObjectNamespaceMap.cs
- GridViewColumnCollection.cs
- ToolStripButton.cs
- BindingContext.cs
- AttachedAnnotation.cs
- RTTypeWrapper.cs
- MaskInputRejectedEventArgs.cs
- CngKey.cs
- SimpleFileLog.cs
- XamlInt32CollectionSerializer.cs
- XmlDataProvider.cs