Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / Policy / ApplicationDirectory.cs / 1305376 / ApplicationDirectory.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// ApplicationDirectory.cs
//
// [....]
//
// ApplicationDirectory is an evidence type representing the directory the assembly
// was loaded from.
//
namespace System.Security.Policy {
using System;
using System.IO;
using System.Security.Util;
using System.Collections;
using System.Diagnostics.Contracts;
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ApplicationDirectory : EvidenceBase
{
private URLString m_appDirectory;
public ApplicationDirectory( String name )
{
if (name == null)
throw new ArgumentNullException( "name" );
Contract.EndContractBlock();
m_appDirectory = new URLString( name );
}
private ApplicationDirectory(URLString appDirectory)
{
Contract.Assert(appDirectory != null);
m_appDirectory = appDirectory;
}
public String Directory
{
get
{
return m_appDirectory.ToString();
}
}
public override bool Equals(Object o)
{
ApplicationDirectory other = o as ApplicationDirectory;
if (other == null)
{
return false;
}
return m_appDirectory.Equals(other.m_appDirectory);
}
public override int GetHashCode()
{
return this.m_appDirectory.GetHashCode();
}
public override EvidenceBase Clone()
{
return new ApplicationDirectory(m_appDirectory);
}
public Object Copy()
{
return Clone();
}
internal SecurityElement ToXml()
{
SecurityElement root = new SecurityElement( "System.Security.Policy.ApplicationDirectory" );
// If you hit this assert then most likely you are trying to change the name of this class.
// This is ok as long as you change the hard coded string above and change the assert below.
Contract.Assert( this.GetType().FullName.Equals( "System.Security.Policy.ApplicationDirectory" ), "Class name changed!" );
root.AddAttribute( "version", "1" );
if (m_appDirectory != null)
root.AddChild( new SecurityElement( "Directory", m_appDirectory.ToString() ) );
return root;
}
public override String ToString()
{
return ToXml().ToString();
}
}
}
// 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
- IntegrationExceptionEventArgs.cs
- UnsafeNativeMethods.cs
- HGlobalSafeHandle.cs
- WebPartCatalogAddVerb.cs
- WindowsAuthenticationModule.cs
- MessageBodyDescription.cs
- StringUtil.cs
- StringInfo.cs
- PolyBezierSegmentFigureLogic.cs
- complextypematerializer.cs
- LicenseProviderAttribute.cs
- ParserContext.cs
- Span.cs
- FileEnumerator.cs
- DocumentXmlWriter.cs
- DictionaryContent.cs
- DataRowChangeEvent.cs
- XamlFrame.cs
- WorkerRequest.cs
- DataServiceStreamProviderWrapper.cs
- SecuritySessionClientSettings.cs
- Transaction.cs
- WorkflowClientDeliverMessageWrapper.cs
- ButtonRenderer.cs
- DataGridViewHeaderCell.cs
- ConfigurationSectionHelper.cs
- NestedContainer.cs
- HttpListenerRequestUriBuilder.cs
- MetadataHelper.cs
- SlotInfo.cs
- AuthenticationManager.cs
- Span.cs
- XmlSchemaImporter.cs
- HtmlTable.cs
- Sentence.cs
- NetworkInformationPermission.cs
- DefaultPropertyAttribute.cs
- DeadLetterQueue.cs
- ScrollableControl.cs
- METAHEADER.cs
- UrlRoutingHandler.cs
- ReflectionServiceProvider.cs
- SQLInt16.cs
- AndCondition.cs
- NGCPageContentCollectionSerializerAsync.cs
- NetworkStream.cs
- LeafCellTreeNode.cs
- EventLogConfiguration.cs
- GridViewDeletedEventArgs.cs
- HtmlElementCollection.cs
- WebBrowserNavigatingEventHandler.cs
- TreeView.cs
- DataGridCommandEventArgs.cs
- DataObjectAttribute.cs
- DataTableExtensions.cs
- WindowsListViewGroupHelper.cs
- CfgParser.cs
- CertificateManager.cs
- SendSecurityHeaderElement.cs
- StylusButton.cs
- ClientRuntimeConfig.cs
- ParameterCollectionEditorForm.cs
- MethodRental.cs
- CodeThrowExceptionStatement.cs
- XmlSchemaSubstitutionGroup.cs
- IFormattable.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- ZipPackagePart.cs
- SqlCommandSet.cs
- CategoryList.cs
- Columns.cs
- Guid.cs
- ThrowHelper.cs
- TypeValidationEventArgs.cs
- DATA_BLOB.cs
- ResourceProperty.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- TrackingMemoryStream.cs
- BitFlagsGenerator.cs
- CollectionType.cs
- OleDbStruct.cs
- ReachUIElementCollectionSerializer.cs
- ErrorWebPart.cs
- FactoryMaker.cs
- IndependentAnimationStorage.cs
- NativeWindow.cs
- InternalBase.cs
- TouchFrameEventArgs.cs
- LeaseManager.cs
- TypeNameParser.cs
- WebServiceEndpoint.cs
- HttpCookiesSection.cs
- UrlPropertyAttribute.cs
- DesignerActionMethodItem.cs
- DbParameterCollection.cs
- HighContrastHelper.cs
- AppDomain.cs
- MSAAEventDispatcher.cs
- ResourceExpressionBuilder.cs
- LambdaCompiler.ControlFlow.cs