System.Security.Util.XMLUtil.AddClassAttribute C# (CSharp) Method

AddClassAttribute() public static method

public static AddClassAttribute ( SecurityElement element, Type type, String typename ) : void
element System.Security.SecurityElement
type System.Type
typename String
return void
        AddClassAttribute( SecurityElement element, Type type, String typename )
        {
            // Replace any quotes with apostrophes so that we can include quoted materials
            // within classnames.  Notably the assembly name member 'loc' uses a quoted string.
        
            // NOTE: this makes assumptions as to what reflection is expecting for a type string
            // it will need to be updated if reflection changes what it wants.
        
            if ( typename == null )
                typename = type.FullName;
            BCLDebug.Assert( type.FullName.Equals( typename ), "Incorrect class name passed! Was : " + typename + " Shoule be: " + type.FullName);
            element.AddAttribute( "class", typename + ", " + type.Module.Assembly.FullName.Replace( '\"', '\'' ) );
        }