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
- QuaternionAnimationBase.cs
- CreateRefExpr.cs
- Rotation3D.cs
- DateTime.cs
- PictureBox.cs
- sqlpipe.cs
- SoapUnknownHeader.cs
- GridViewSortEventArgs.cs
- MetricEntry.cs
- PageResolution.cs
- SelectionUIHandler.cs
- WorkflowMarkupElementEventArgs.cs
- InstanceOwnerQueryResult.cs
- ComboBoxHelper.cs
- DoubleAnimationClockResource.cs
- DataGridViewColumnEventArgs.cs
- SourceElementsCollection.cs
- LockCookie.cs
- EdmValidator.cs
- HtmlTableRow.cs
- codemethodreferenceexpression.cs
- AuthorizationRule.cs
- WhitespaceRuleReader.cs
- FormsAuthenticationModule.cs
- DataTableTypeConverter.cs
- RightsManagementEncryptedStream.cs
- CodeAssignStatement.cs
- RangeBaseAutomationPeer.cs
- ListBoxAutomationPeer.cs
- FastEncoderWindow.cs
- ProxyGenerationError.cs
- OpenTypeLayout.cs
- hresults.cs
- ControlEvent.cs
- XPathChildIterator.cs
- Grant.cs
- MissingManifestResourceException.cs
- InvokeHandlers.cs
- Reference.cs
- SiteMap.cs
- Processor.cs
- Base64Encoder.cs
- FileDialogCustomPlace.cs
- TreeNodeBindingCollection.cs
- IsolatedStoragePermission.cs
- listitem.cs
- ExtensionSimplifierMarkupObject.cs
- DrawingContext.cs
- ClassData.cs
- HandlerBase.cs
- DbConnectionPoolCounters.cs
- DataSourceHelper.cs
- StaticDataManager.cs
- PerformanceCountersElement.cs
- SelectingProviderEventArgs.cs
- SelectorItemAutomationPeer.cs
- ColorConverter.cs
- WSFederationHttpSecurityMode.cs
- XmlSchema.cs
- MessageDecoder.cs
- ReadOnlyPropertyMetadata.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- GuidelineCollection.cs
- ExceptionRoutedEventArgs.cs
- GeometryCollection.cs
- StringValidatorAttribute.cs
- XmlUTF8TextWriter.cs
- WindowsGraphicsCacheManager.cs
- TrackingParameters.cs
- Attributes.cs
- SpecularMaterial.cs
- Convert.cs
- TreeViewItem.cs
- StreamingContext.cs
- TakeOrSkipWhileQueryOperator.cs
- RelationshipWrapper.cs
- TrackBarRenderer.cs
- Parser.cs
- SQlBooleanStorage.cs
- SurrogateEncoder.cs
- BitmapSourceSafeMILHandle.cs
- Rotation3DAnimationUsingKeyFrames.cs
- PreApplicationStartMethodAttribute.cs
- DocumentEventArgs.cs
- ServiceModelConfigurationElementCollection.cs
- ModifiableIteratorCollection.cs
- ResourcesBuildProvider.cs
- SafeNativeMethods.cs
- PngBitmapEncoder.cs
- PermissionSetEnumerator.cs
- OutputCacheModule.cs
- ServiceCredentialsSecurityTokenManager.cs
- Configuration.cs
- MenuItem.cs
- objectresult_tresulttype.cs
- CatalogPart.cs
- RunWorkerCompletedEventArgs.cs
- InlinedAggregationOperator.cs
- DependentList.cs
- HttpContext.cs