Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Runtime / Versioning / MultitargetingHelpers.cs / 1305376 / MultitargetingHelpers.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*============================================================
**
** Class: MultitargetingHelpers
**
** [....]
**
**
** Purpose: Central repository for helpers supporting
** multitargeting, such as emitting the correct version numbers
** and assembly names.
**
**
===========================================================*/
namespace System.Runtime.Versioning
{
using System;
using System.IO;
using System.Text;
using System.Diagnostics.Contracts;
internal static class MultitargetingHelpers
{
// default type converter
private static Func defaultConverter = (t) => t.AssemblyQualifiedName;
// This method gets assembly info for the corresponding type. If the typeConverter
// is provided it is used to get this information.
internal static string GetAssemblyQualifiedName(Type type, Func converter)
{
string assemblyFullName = null;
if (type != null)
{
if (converter != null)
{
try
{
assemblyFullName = converter(type);
//
}
catch (Exception e)
{
if (IsSecurityOrCriticalException(e))
{
throw;
}
}
}
if (assemblyFullName == null)
{
assemblyFullName = defaultConverter(type);
}
}
return assemblyFullName;
}
private static bool IsCriticalException(Exception ex)
{
return ex is NullReferenceException
|| ex is StackOverflowException
|| ex is OutOfMemoryException
|| ex is System.Threading.ThreadAbortException
|| ex is IndexOutOfRangeException
|| ex is AccessViolationException;
}
private static bool IsSecurityOrCriticalException(Exception ex)
{
return (ex is System.Security.SecurityException) || IsCriticalException(ex);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*============================================================
**
** Class: MultitargetingHelpers
**
** [....]
**
**
** Purpose: Central repository for helpers supporting
** multitargeting, such as emitting the correct version numbers
** and assembly names.
**
**
===========================================================*/
namespace System.Runtime.Versioning
{
using System;
using System.IO;
using System.Text;
using System.Diagnostics.Contracts;
internal static class MultitargetingHelpers
{
// default type converter
private static Func defaultConverter = (t) => t.AssemblyQualifiedName;
// This method gets assembly info for the corresponding type. If the typeConverter
// is provided it is used to get this information.
internal static string GetAssemblyQualifiedName(Type type, Func converter)
{
string assemblyFullName = null;
if (type != null)
{
if (converter != null)
{
try
{
assemblyFullName = converter(type);
//
}
catch (Exception e)
{
if (IsSecurityOrCriticalException(e))
{
throw;
}
}
}
if (assemblyFullName == null)
{
assemblyFullName = defaultConverter(type);
}
}
return assemblyFullName;
}
private static bool IsCriticalException(Exception ex)
{
return ex is NullReferenceException
|| ex is StackOverflowException
|| ex is OutOfMemoryException
|| ex is System.Threading.ThreadAbortException
|| ex is IndexOutOfRangeException
|| ex is AccessViolationException;
}
private static bool IsSecurityOrCriticalException(Exception ex)
{
return (ex is System.Security.SecurityException) || IsCriticalException(ex);
}
}
}
// 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
- FamilyCollection.cs
- PropertyTab.cs
- StickyNoteHelper.cs
- ConfigXmlCDataSection.cs
- SliderAutomationPeer.cs
- JsonReader.cs
- WebPartCollection.cs
- XmlTextReader.cs
- RegexInterpreter.cs
- SystemIPAddressInformation.cs
- EmptyStringExpandableObjectConverter.cs
- EditorZone.cs
- KeyedCollection.cs
- WebControl.cs
- KnowledgeBase.cs
- Effect.cs
- OrCondition.cs
- HttpValueCollection.cs
- RedirectionProxy.cs
- Automation.cs
- DataGridViewComboBoxColumn.cs
- SafeFileHandle.cs
- RC2.cs
- DbDataSourceEnumerator.cs
- FixedSOMTableCell.cs
- MergeFilterQuery.cs
- IgnoreSectionHandler.cs
- CustomError.cs
- CodeGenHelper.cs
- GridViewDeletedEventArgs.cs
- DataControlCommands.cs
- QueryOptionExpression.cs
- OlePropertyStructs.cs
- WebPartZoneCollection.cs
- DesignParameter.cs
- PageCache.cs
- _ScatterGatherBuffers.cs
- DataServiceRequestException.cs
- Point3DCollectionConverter.cs
- FragmentNavigationEventArgs.cs
- FlagsAttribute.cs
- CacheOutputQuery.cs
- TextUtf8RawTextWriter.cs
- FreezableDefaultValueFactory.cs
- DelegateInArgument.cs
- TabletCollection.cs
- SqlGenericUtil.cs
- BufferedOutputAsyncStream.cs
- FloaterBaseParaClient.cs
- TypographyProperties.cs
- SaveFileDialog.cs
- ValidationError.cs
- PageStatePersister.cs
- BitmapData.cs
- BreadCrumbTextConverter.cs
- RegexCapture.cs
- NativeMethods.cs
- SQLBinaryStorage.cs
- X509CertificateRecipientClientCredential.cs
- NativeCppClassAttribute.cs
- WorkflowService.cs
- OleDbErrorCollection.cs
- Operand.cs
- QueryExpr.cs
- XPathNodePointer.cs
- IIS7UserPrincipal.cs
- RelatedView.cs
- DictionaryContent.cs
- SQLResource.cs
- TemplateFactory.cs
- InspectionWorker.cs
- WebPartsSection.cs
- ConfigXmlText.cs
- DeobfuscatingStream.cs
- _Connection.cs
- SQLInt64Storage.cs
- TransformerTypeCollection.cs
- WinFormsSecurity.cs
- RecognitionEventArgs.cs
- TriggerAction.cs
- UnionCodeGroup.cs
- LabelDesigner.cs
- WindowInteropHelper.cs
- PassportAuthenticationModule.cs
- RadioButtonStandardAdapter.cs
- SystemUdpStatistics.cs
- ToolboxItemAttribute.cs
- MemberProjectionIndex.cs
- D3DImage.cs
- GridViewCommandEventArgs.cs
- EntityDataSourceChangedEventArgs.cs
- ControlIdConverter.cs
- CodeRegionDirective.cs
- RelatedPropertyManager.cs
- DataServiceHostWrapper.cs
- SinglePhaseEnlistment.cs
- ResourcePool.cs
- UserControlCodeDomTreeGenerator.cs
- RegisteredExpandoAttribute.cs
- InternalsVisibleToAttribute.cs