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
- FixUp.cs
- Main.cs
- XmlEventCache.cs
- MessageHeaderException.cs
- _ChunkParse.cs
- WebPartDeleteVerb.cs
- HttpRequestTraceRecord.cs
- ChangesetResponse.cs
- ReadOnlyNameValueCollection.cs
- TextClipboardData.cs
- XmlSchemaSearchPattern.cs
- MailFileEditor.cs
- SoapConverter.cs
- ProjectionPathBuilder.cs
- SystemInfo.cs
- SmiTypedGetterSetter.cs
- DataSourceControlBuilder.cs
- HuffmanTree.cs
- EnumValAlphaComparer.cs
- cookieexception.cs
- Style.cs
- PageRouteHandler.cs
- SortedList.cs
- SqlCharStream.cs
- LinqDataSourceValidationException.cs
- ClientBuildManager.cs
- CancellationHandlerDesigner.cs
- ContentValidator.cs
- MatcherBuilder.cs
- LoadedOrUnloadedOperation.cs
- SqlDataSourceFilteringEventArgs.cs
- Point4D.cs
- Timer.cs
- TableAutomationPeer.cs
- ThicknessAnimationUsingKeyFrames.cs
- SemanticTag.cs
- RoutedEventHandlerInfo.cs
- ScriptIgnoreAttribute.cs
- ProcessProtocolHandler.cs
- BooleanFunctions.cs
- InputLangChangeEvent.cs
- LocalFileSettingsProvider.cs
- WebConfigurationHost.cs
- TypeUnloadedException.cs
- MimePart.cs
- EventArgs.cs
- ZoneIdentityPermission.cs
- LayoutUtils.cs
- documentation.cs
- ScaleTransform3D.cs
- BufferAllocator.cs
- SmtpAuthenticationManager.cs
- XslTransform.cs
- TypeBuilder.cs
- GACMembershipCondition.cs
- InheritanceAttribute.cs
- StrongNameUtility.cs
- DynamicMethod.cs
- KeyManager.cs
- ToolStripManager.cs
- SchemeSettingElementCollection.cs
- Function.cs
- WSSecureConversationDec2005.cs
- GPPOINT.cs
- FieldBuilder.cs
- RelationshipFixer.cs
- ClockGroup.cs
- RefreshResponseInfo.cs
- SizeAnimation.cs
- HandlerElement.cs
- Common.cs
- CustomPopupPlacement.cs
- InvalidateEvent.cs
- SchemaCompiler.cs
- KnownColorTable.cs
- InternalConfigRoot.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- HandleRef.cs
- EditorPartCollection.cs
- SqlGenericUtil.cs
- ObjectListCommandCollection.cs
- JoinCqlBlock.cs
- WindowsFormsLinkLabel.cs
- CodeAssignStatement.cs
- CollectionViewGroupInternal.cs
- WorkflowServiceHostFactory.cs
- NonSerializedAttribute.cs
- CollectionConverter.cs
- ChameleonKey.cs
- AlphaSortedEnumConverter.cs
- TreeNodeSelectionProcessor.cs
- CompiledQueryCacheEntry.cs
- ApplyImportsAction.cs
- VersionedStreamOwner.cs
- TriggerBase.cs
- DiscoveryDocument.cs
- BufferedGraphicsManager.cs
- MenuItem.cs
- ZoneIdentityPermission.cs
- HttpModulesSection.cs