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
- Animatable.cs
- DocumentSequence.cs
- WebPartHeaderCloseVerb.cs
- LayoutTableCell.cs
- X509Extension.cs
- UserNameSecurityTokenAuthenticator.cs
- DbProviderServices.cs
- IMembershipProvider.cs
- WindowsFormsHost.cs
- ByValueEqualityComparer.cs
- VirtualizingStackPanel.cs
- ClientSettings.cs
- DynamicUpdateCommand.cs
- PairComparer.cs
- AlignmentXValidation.cs
- TabControlToolboxItem.cs
- Vector3D.cs
- PartialCachingControl.cs
- OutOfProcStateClientManager.cs
- ErrorFormatter.cs
- TreeViewAutomationPeer.cs
- SecurityAppliedMessage.cs
- ModifierKeysValueSerializer.cs
- Hyperlink.cs
- XmlSchemaAppInfo.cs
- MemoryMappedFileSecurity.cs
- TrayIconDesigner.cs
- BamlWriter.cs
- BaseTemplateParser.cs
- MembershipUser.cs
- ListBindingConverter.cs
- PenThread.cs
- HtmlShim.cs
- PageAsyncTaskManager.cs
- WebPartTracker.cs
- SecurityPermission.cs
- MbpInfo.cs
- ReferentialConstraint.cs
- VirtualPath.cs
- HandlerFactoryCache.cs
- KnownTypes.cs
- Stack.cs
- SafeRightsManagementHandle.cs
- ParameterElementCollection.cs
- AutoCompleteStringCollection.cs
- AuthenticationModuleElement.cs
- FilterQuery.cs
- UnaryNode.cs
- XmlDataSource.cs
- RepeaterDataBoundAdapter.cs
- ClientApiGenerator.cs
- MenuItemAutomationPeer.cs
- DataGridCellAutomationPeer.cs
- ReferencedAssembly.cs
- SplashScreen.cs
- BufferModeSettings.cs
- AcceptorSessionSymmetricMessageSecurityProtocol.cs
- XmlAnyElementAttribute.cs
- ScrollBar.cs
- DebuggerService.cs
- FindResponse.cs
- WebPartPersonalization.cs
- UInt64.cs
- MultiAsyncResult.cs
- ResolvedKeyFrameEntry.cs
- WorkflowOperationAsyncResult.cs
- AutomationPattern.cs
- Assembly.cs
- ConfigurationSchemaErrors.cs
- ToolStripRendererSwitcher.cs
- ASCIIEncoding.cs
- PropertyChangingEventArgs.cs
- SqlFacetAttribute.cs
- X509SecurityToken.cs
- CustomAttributeSerializer.cs
- CharacterHit.cs
- ExtentCqlBlock.cs
- DiscoveryDocumentSerializer.cs
- FrameSecurityDescriptor.cs
- MainMenu.cs
- RawTextInputReport.cs
- GroupJoinQueryOperator.cs
- PersonalizationStateQuery.cs
- EmptyEnumerator.cs
- DataFormats.cs
- LazyInitializer.cs
- Atom10FormatterFactory.cs
- Convert.cs
- XmlElement.cs
- EventListenerClientSide.cs
- PageCache.cs
- sqlmetadatafactory.cs
- unsafenativemethodsother.cs
- WebRequestModulesSection.cs
- ProfessionalColorTable.cs
- BufferBuilder.cs
- ThreadStateException.cs
- SqlInfoMessageEvent.cs
- BinaryFormatterWriter.cs
- PerformanceCounterCategory.cs