Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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; } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- IndexOutOfRangeException.cs
- StringWriter.cs
- ScrollEventArgs.cs
- SqlHelper.cs
- InOutArgument.cs
- Operand.cs
- TypeGenericEnumerableViewSchema.cs
- WebPartConnectionsCloseVerb.cs
- InteropEnvironment.cs
- SimpleWorkerRequest.cs
- OLEDB_Util.cs
- WebResourceAttribute.cs
- HuffmanTree.cs
- ListDictionaryInternal.cs
- HostingEnvironmentWrapper.cs
- TrackBar.cs
- IdleTimeoutMonitor.cs
- GPRECTF.cs
- XmlQuerySequence.cs
- ContextStack.cs
- SystemIPv6InterfaceProperties.cs
- MouseButtonEventArgs.cs
- Item.cs
- DashStyles.cs
- basemetadatamappingvisitor.cs
- OutputCacheSettingsSection.cs
- CryptoConfig.cs
- ServiceChannelManager.cs
- EncodingInfo.cs
- StdValidatorsAndConverters.cs
- NumberSubstitution.cs
- SoapAttributes.cs
- StringInfo.cs
- ConnectionPointCookie.cs
- Char.cs
- CategoryAttribute.cs
- Thickness.cs
- SystemIPv6InterfaceProperties.cs
- FocusWithinProperty.cs
- FixedDocumentPaginator.cs
- BmpBitmapDecoder.cs
- PreviewPageInfo.cs
- IISUnsafeMethods.cs
- Win32Native.cs
- CancellationTokenRegistration.cs
- ThreadAbortException.cs
- GatewayDefinition.cs
- XmlDocumentType.cs
- SoapInteropTypes.cs
- MenuCommandsChangedEventArgs.cs
- JavaScriptSerializer.cs
- Listbox.cs
- HMACRIPEMD160.cs
- GacUtil.cs
- TypeBuilder.cs
- DetailsViewRowCollection.cs
- Point.cs
- StringConcat.cs
- WebPartEditorApplyVerb.cs
- DefaultClaimSet.cs
- ReflectionPermission.cs
- RegisteredDisposeScript.cs
- TiffBitmapDecoder.cs
- SoundPlayerAction.cs
- FlowLayoutSettings.cs
- ClientBuildManager.cs
- Contracts.cs
- EntitySetDataBindingList.cs
- AssemblyFilter.cs
- FtpWebResponse.cs
- ClrPerspective.cs
- EncoderExceptionFallback.cs
- StylusPointCollection.cs
- DataListItem.cs
- SizeValueSerializer.cs
- JsonDataContract.cs
- AppearanceEditorPart.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- MobilePage.cs
- UnsafeNativeMethods.cs
- WebPartConnectionsCancelEventArgs.cs
- OciEnlistContext.cs
- DataGridViewAutoSizeModeEventArgs.cs
- FloaterParagraph.cs
- LayoutEngine.cs
- CallbackBehaviorAttribute.cs
- SocketAddress.cs
- DesignerVerb.cs
- XmlName.cs
- ThaiBuddhistCalendar.cs
- mediaclock.cs
- PixelFormats.cs
- contentDescriptor.cs
- TableLayout.cs
- TextRangeProviderWrapper.cs
- OSFeature.cs
- CriticalExceptions.cs
- assertwrapper.cs
- XmlSchema.cs
- ScrollChangedEventArgs.cs