Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / clr / src / BCL / System / Security / Principal / GenericPrincipal.cs / 1 / GenericPrincipal.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // GenericPrincipal.cs // namespace System.Security.Principal { using System.Runtime.Remoting; using System; using System.Security.Util; using System.Globalization; [Serializable] [System.Runtime.InteropServices.ComVisible(true)] public class GenericPrincipal : IPrincipal { private IIdentity m_identity; private string[] m_roles; public GenericPrincipal (IIdentity identity, string[] roles) { if (identity == null) throw new ArgumentNullException("identity"); m_identity = identity; if (roles != null) { m_roles = new string[roles.Length]; for (int i = 0; i < roles.Length; ++i) { m_roles[i] = roles[i]; } } else { m_roles = null; } } public virtual IIdentity Identity { get { return m_identity; } } public virtual bool IsInRole (string role) { if (role == null || m_roles == null) return false; for (int i = 0; i < m_roles.Length; ++i) { if (m_roles[i] != null && String.Compare(m_roles[i], role, StringComparison.OrdinalIgnoreCase) == 0) return true; } return false; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // GenericPrincipal.cs // namespace System.Security.Principal { using System.Runtime.Remoting; using System; using System.Security.Util; using System.Globalization; [Serializable] [System.Runtime.InteropServices.ComVisible(true)] public class GenericPrincipal : IPrincipal { private IIdentity m_identity; private string[] m_roles; public GenericPrincipal (IIdentity identity, string[] roles) { if (identity == null) throw new ArgumentNullException("identity"); m_identity = identity; if (roles != null) { m_roles = new string[roles.Length]; for (int i = 0; i < roles.Length; ++i) { m_roles[i] = roles[i]; } } else { m_roles = null; } } public virtual IIdentity Identity { get { return m_identity; } } public virtual bool IsInRole (string role) { if (role == null || m_roles == null) return false; for (int i = 0; i < m_roles.Length; ++i) { if (m_roles[i] != null && String.Compare(m_roles[i], role, StringComparison.OrdinalIgnoreCase) == 0) return true; } return false; } } } // 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
- NativeWrapper.cs
- FastEncoderWindow.cs
- SqlHelper.cs
- WorkflowApplicationAbortedException.cs
- ParameterElement.cs
- CodeNamespace.cs
- HttpConfigurationContext.cs
- XmlEntity.cs
- ContextMenu.cs
- Crypto.cs
- RightsManagementEncryptedStream.cs
- ArgumentException.cs
- Proxy.cs
- VarInfo.cs
- OdbcConnectionFactory.cs
- SystemResourceKey.cs
- TextLineBreak.cs
- ResourcePool.cs
- CrossContextChannel.cs
- DBParameter.cs
- CharacterBuffer.cs
- BuildProviderUtils.cs
- AppLevelCompilationSectionCache.cs
- ToggleButton.cs
- StreamGeometry.cs
- Misc.cs
- util.cs
- TransactionManager.cs
- XmlDataSourceNodeDescriptor.cs
- SystemColors.cs
- EventSetter.cs
- DBSqlParserColumn.cs
- ProcessModelSection.cs
- ResourcesBuildProvider.cs
- Int16KeyFrameCollection.cs
- CodeIdentifier.cs
- AggregateNode.cs
- DataTableNewRowEvent.cs
- ItemCollection.cs
- SqlStream.cs
- WithParamAction.cs
- TableItemStyle.cs
- SoundPlayer.cs
- SoapTypeAttribute.cs
- PrePostDescendentsWalker.cs
- SystemColorTracker.cs
- XmlILModule.cs
- Comparer.cs
- CheckBoxList.cs
- XmlArrayItemAttribute.cs
- StorageFunctionMapping.cs
- GeometryModel3D.cs
- ForEachAction.cs
- TypeUsage.cs
- MenuItem.cs
- SplineKeyFrames.cs
- BordersPage.cs
- CustomErrorCollection.cs
- WebMethodAttribute.cs
- TiffBitmapDecoder.cs
- Bold.cs
- PerformanceCounterManager.cs
- WindowsPen.cs
- TreeNodeCollection.cs
- ListCollectionView.cs
- DropTarget.cs
- TextAction.cs
- RegexInterpreter.cs
- ConfigurationSectionHelper.cs
- XmlSchemaAttribute.cs
- AuthenticatedStream.cs
- SchemaConstraints.cs
- Oid.cs
- DragCompletedEventArgs.cs
- MDIClient.cs
- NativeMethods.cs
- WebBrowserPermission.cs
- ScaleTransform3D.cs
- IssuanceLicense.cs
- DoubleCollection.cs
- BindUriHelper.cs
- CfgArc.cs
- DynamicEndpoint.cs
- SafeNativeMethods.cs
- Types.cs
- SiteOfOriginPart.cs
- ColumnBinding.cs
- XmlQualifiedName.cs
- AnnotationResourceChangedEventArgs.cs
- TemplateInstanceAttribute.cs
- CodeAttachEventStatement.cs
- SerializationInfoEnumerator.cs
- MenuItemCollectionEditorDialog.cs
- DataGridItemAttachedStorage.cs
- MergeLocalizationDirectives.cs
- PriorityChain.cs
- DigestComparer.cs
- WebService.cs
- TextAnchor.cs
- RegionInfo.cs