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
- HandoffBehavior.cs
- Relationship.cs
- Component.cs
- PtsContext.cs
- FixedSOMImage.cs
- SqlServices.cs
- _NetworkingPerfCounters.cs
- GiveFeedbackEvent.cs
- DefaultIfEmptyQueryOperator.cs
- BindToObject.cs
- GridView.cs
- CompModSwitches.cs
- HyperLinkField.cs
- WindowsRebar.cs
- StateFinalizationDesigner.cs
- XmlSchemaAppInfo.cs
- AttachInfo.cs
- PackUriHelper.cs
- UnsafeCollabNativeMethods.cs
- RemotingConfigParser.cs
- MissingManifestResourceException.cs
- WindowsIdentity.cs
- XmlSiteMapProvider.cs
- XmlExceptionHelper.cs
- LocalizableResourceBuilder.cs
- ToolboxItem.cs
- SplineKeyFrames.cs
- SiteMapDataSourceView.cs
- X509CertificateCollection.cs
- ETagAttribute.cs
- HttpTransportElement.cs
- FileVersionInfo.cs
- sqlser.cs
- SafeHandle.cs
- ThaiBuddhistCalendar.cs
- PermissionListSet.cs
- AlgoModule.cs
- ColumnMapCopier.cs
- ISAPIRuntime.cs
- EnumerableRowCollectionExtensions.cs
- BuilderElements.cs
- PeerNameRecordCollection.cs
- ReliableReplySessionChannel.cs
- AuthorizationSection.cs
- Table.cs
- HtmlInputButton.cs
- SerializationAttributes.cs
- IndicShape.cs
- ReaderWriterLock.cs
- HelpInfo.cs
- Padding.cs
- AssociationTypeEmitter.cs
- SqlExpressionNullability.cs
- FlowLayoutSettings.cs
- GetKeyedHashRequest.cs
- DataSourceSerializationException.cs
- LinearQuaternionKeyFrame.cs
- InvalidOleVariantTypeException.cs
- util.cs
- FixedPageAutomationPeer.cs
- HashRepartitionStream.cs
- Menu.cs
- PropertyTabAttribute.cs
- Utils.cs
- HelpKeywordAttribute.cs
- CacheOutputQuery.cs
- TypeElementCollection.cs
- Binding.cs
- _PooledStream.cs
- GeometryCollection.cs
- PowerStatus.cs
- Condition.cs
- WinInet.cs
- Matrix3D.cs
- UnSafeCharBuffer.cs
- DocumentGridPage.cs
- EventInfo.cs
- Deflater.cs
- PageAsyncTask.cs
- AccessDataSource.cs
- NotifyCollectionChangedEventArgs.cs
- StylusButtonCollection.cs
- RegexCompiler.cs
- URIFormatException.cs
- sqlinternaltransaction.cs
- AnnotationComponentChooser.cs
- VSDExceptions.cs
- TraceContextEventArgs.cs
- SafeFileMappingHandle.cs
- WebPartConnectionsConfigureVerb.cs
- ZipIOLocalFileBlock.cs
- InternalConfigHost.cs
- StoreItemCollection.cs
- BaseProcessor.cs
- figurelengthconverter.cs
- OneOfElement.cs
- LongAverageAggregationOperator.cs
- HttpRuntime.cs
- ZipArchive.cs
- TemplateInstanceAttribute.cs