PrivilegeNotHeldException.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / System / Security / AccessControl / PrivilegeNotHeldException.cs / 1 / PrivilegeNotHeldException.cs

                            using Microsoft.Win32; 
using System;
using System.Runtime.Serialization;
using System.Text;
using System.Globalization; 
using System.Security.Permissions;
 
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; } 
        }
 
        [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)] 		 
        public override void GetObjectData( SerializationInfo info, StreamingContext context )
        { 
            if ( info == null )
            {
                throw new ArgumentNullException( "info" );
            } 

            base.GetObjectData(info, context); 
 
            info.AddValue("PrivilegeName", _privilegeName, typeof( string ));
        } 
    }
}
                        

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