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
- SqlProfileProvider.cs
- RegularExpressionValidator.cs
- arclist.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- MSAAWinEventWrap.cs
- ObjectStateManagerMetadata.cs
- ToolStripLocationCancelEventArgs.cs
- InputBinding.cs
- RayMeshGeometry3DHitTestResult.cs
- RectangleGeometry.cs
- GenericUriParser.cs
- OLEDB_Util.cs
- TreeNode.cs
- CqlGenerator.cs
- RNGCryptoServiceProvider.cs
- ImageMetadata.cs
- RichTextBoxAutomationPeer.cs
- XmlSchemaProviderAttribute.cs
- SoapClientMessage.cs
- ListBoxItemAutomationPeer.cs
- HttpContext.cs
- SpecialFolderEnumConverter.cs
- Function.cs
- Vector3DAnimationBase.cs
- DataColumnMappingCollection.cs
- SqlBinder.cs
- AttributeAction.cs
- PrintDialogException.cs
- DrawingContextWalker.cs
- DataBindingCollection.cs
- InheritablePropertyChangeInfo.cs
- x509store.cs
- Literal.cs
- SliderAutomationPeer.cs
- CodeAccessSecurityEngine.cs
- DefaultBinder.cs
- ActivityExecutorOperation.cs
- updateconfighost.cs
- SspiSecurityTokenProvider.cs
- Wildcard.cs
- Effect.cs
- SeekStoryboard.cs
- FunctionUpdateCommand.cs
- WebPartMovingEventArgs.cs
- GeneralTransform3DGroup.cs
- SqlDependencyUtils.cs
- TypeExtensions.cs
- DefaultHttpHandler.cs
- Error.cs
- CalendarDay.cs
- AmbiguousMatchException.cs
- unsafenativemethodstextservices.cs
- WaitHandle.cs
- SqlInfoMessageEvent.cs
- Tablet.cs
- XmlSchemaSimpleTypeUnion.cs
- WebRequest.cs
- Comparer.cs
- StreamAsIStream.cs
- GPPOINTF.cs
- LineServicesRun.cs
- DecoderExceptionFallback.cs
- FontInfo.cs
- XmlArrayItemAttributes.cs
- WebRequestModuleElementCollection.cs
- LayoutTableCell.cs
- RC2.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- ObjectFullSpanRewriter.cs
- ToolBar.cs
- SystemInformation.cs
- CommandHelper.cs
- FilterElement.cs
- FrameworkContentElement.cs
- Bits.cs
- AsymmetricSignatureFormatter.cs
- Int32CAMarshaler.cs
- Message.cs
- ChildTable.cs
- Preprocessor.cs
- XmlMemberMapping.cs
- OletxCommittableTransaction.cs
- VolatileEnlistmentState.cs
- Size3D.cs
- ParseElementCollection.cs
- SQLInt64Storage.cs
- HtmlButton.cs
- ConnectionManagementElement.cs
- MonikerBuilder.cs
- FixUp.cs
- VSWCFServiceContractGenerator.cs
- Buffer.cs
- CheckoutException.cs
- WebPartConnectVerb.cs
- AttributeEmitter.cs
- HttpListenerElement.cs
- UnsafeNativeMethods.cs
- CompiledXpathExpr.cs
- TextTrailingWordEllipsis.cs
- ManagedIStream.cs