PrivilegeNotHeldException.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / AccessControl / PrivilegeNotHeldException.cs / 1305376 / PrivilegeNotHeldException.cs

                            using Microsoft.Win32; 
using System;
using System.Runtime.Serialization;
using System.Text;
using System.Globalization; 
using System.Security.Permissions;
using System.Diagnostics.Contracts; 
 
namespace System.Security.AccessControl
{ 
    [Serializable]

    public sealed class PrivilegeNotHeldException : UnauthorizedAccessException, ISerializable
    { 
        private readonly string _privilegeName = null;
 
        public PrivilegeNotHeldException() 
            : base( Environment.GetResourceString( "PrivilegeNotHeld_Default" ))
        { 
        }

        public PrivilegeNotHeldException( string privilege )
            : base( string.Format( CultureInfo.CurrentCulture, Environment.GetResourceString( "PrivilegeNotHeld_Named" ), privilege )) 
        {
            _privilegeName = privilege; 
        } 

        public PrivilegeNotHeldException( string privilege, Exception inner ) 
            : base( string.Format( CultureInfo.CurrentCulture, Environment.GetResourceString( "PrivilegeNotHeld_Named" ), privilege ), inner )
        {
            _privilegeName = privilege;
        } 

        internal PrivilegeNotHeldException( SerializationInfo info, StreamingContext context ) 
            : base( info, context ) 
        {
            _privilegeName = info.GetString("PrivilegeName"); 
        }

        public string PrivilegeName
        { 
            get { return _privilegeName; }
        } 
 
        [System.Security.SecurityCritical]  // auto-generated_required
        public override void GetObjectData( SerializationInfo info, StreamingContext context ) 
        {
            if ( info == null )
            {
                throw new ArgumentNullException( "info" ); 
            }
            Contract.EndContractBlock(); 
 
            base.GetObjectData(info, context);
 
            info.AddValue("PrivilegeName", _privilegeName, typeof( string ));
        }
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK