Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Misc / MultitargetUtil.cs / 1305376 / MultitargetUtil.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Resources {
using System;
///
/// Helper class supporting Multitarget type assembly qualified name resolution for ResX API.
/// Note: this file is compiled into different assemblies (runtime and VSIP assemblies ...)
///
internal static class MultitargetUtil
{
///
/// This method gets assembly info for the corresponding type. If the delegate
/// is provided it is used to get this information.
///
public static string GetAssemblyQualifiedName(Type type, Func typeNameConverter)
{
string assemblyQualifiedName = null;
if (type != null)
{
if (typeNameConverter != null)
{
try
{
assemblyQualifiedName = typeNameConverter(type);
}
catch (Exception e)
{
if (IsSecurityOrCriticalException(e))
{
throw;
}
}
}
if (string.IsNullOrEmpty(assemblyQualifiedName))
{
assemblyQualifiedName = type.AssemblyQualifiedName;
}
}
return assemblyQualifiedName;
}
// ExecutionEngineException is obsolete and shouldn't be used (to catch, throw or reference) anymore.
// Pragma added to prevent converting the "type is obsolete" warning into build error.
#pragma warning disable 618
private static bool IsSecurityOrCriticalException(Exception ex)
{
return ex is NullReferenceException
|| ex is StackOverflowException
|| ex is OutOfMemoryException
|| ex is System.Threading.ThreadAbortException
|| ex is ExecutionEngineException
|| ex is IndexOutOfRangeException
|| ex is AccessViolationException
|| ex is System.Security.SecurityException;
}
#pragma warning restore 618
}
}
// 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
- SafeProcessHandle.cs
- ComplusTypeValidator.cs
- _RequestCacheProtocol.cs
- EntityParameterCollection.cs
- SqlAliaser.cs
- XmlSerializableWriter.cs
- Substitution.cs
- StylusPointPropertyInfo.cs
- EncodingStreamWrapper.cs
- SettingsBase.cs
- RequestStatusBarUpdateEventArgs.cs
- UpdateProgress.cs
- ToolBarButtonClickEvent.cs
- QilDataSource.cs
- DataTableCollection.cs
- TaiwanLunisolarCalendar.cs
- AppDomainFactory.cs
- ServiceEndpoint.cs
- WebPartAddingEventArgs.cs
- WebConfigurationFileMap.cs
- AdornedElementPlaceholder.cs
- EFColumnProvider.cs
- ThousandthOfEmRealPoints.cs
- ScrollBarRenderer.cs
- ListManagerBindingsCollection.cs
- LockedActivityGlyph.cs
- ObjRef.cs
- SafeReadContext.cs
- DataGridCellEditEndingEventArgs.cs
- HtmlInputHidden.cs
- SecureStringHasher.cs
- TransactionScopeDesigner.cs
- PenLineCapValidation.cs
- SectionInput.cs
- HashHelper.cs
- XmlSchemaAnnotated.cs
- AppliedDeviceFiltersDialog.cs
- Command.cs
- SecurityVerifiedMessage.cs
- ByteStreamMessageUtility.cs
- SchemaInfo.cs
- KeyTimeConverter.cs
- BackStopAuthenticationModule.cs
- CookieProtection.cs
- NavigatingCancelEventArgs.cs
- SafeFileHandle.cs
- TripleDES.cs
- CancellationHandlerDesigner.cs
- DataExpression.cs
- MouseBinding.cs
- CasesDictionary.cs
- ActivityDesignerAccessibleObject.cs
- BoundPropertyEntry.cs
- XmlSchemaAll.cs
- LinkedResource.cs
- ComponentGuaranteesAttribute.cs
- FormsAuthenticationUserCollection.cs
- UriExt.cs
- WebServiceHandler.cs
- ReadOnlyDataSource.cs
- HotCommands.cs
- PersonalizationProviderCollection.cs
- FixUpCollection.cs
- LocalServiceSecuritySettingsElement.cs
- HtmlContainerControl.cs
- TextSelection.cs
- WebPartUtil.cs
- MessageDescriptionCollection.cs
- XamlReaderHelper.cs
- ToolstripProfessionalRenderer.cs
- FontConverter.cs
- WorkflowInstanceExtensionCollection.cs
- DataControlCommands.cs
- FormsAuthenticationConfiguration.cs
- EncodedStreamFactory.cs
- CounterSet.cs
- ContextDataSource.cs
- x509utils.cs
- RsaSecurityToken.cs
- SecurityTokenAuthenticator.cs
- ValidationErrorCollection.cs
- BindingParameterCollection.cs
- ProfileEventArgs.cs
- ApplicationGesture.cs
- TaskForm.cs
- NavigationWindow.cs
- Quad.cs
- NgenServicingAttributes.cs
- Math.cs
- EmptyReadOnlyDictionaryInternal.cs
- OdbcConnectionStringbuilder.cs
- OuterGlowBitmapEffect.cs
- KerberosRequestorSecurityToken.cs
- StatusBarItem.cs
- SqlRowUpdatingEvent.cs
- X509Utils.cs
- ScrollChrome.cs
- ComponentManagerBroker.cs
- AuthenticationModuleElementCollection.cs
- PlainXmlDeserializer.cs