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 FuncdefaultConverter = (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 FuncdefaultConverter = (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
- OdbcErrorCollection.cs
- XPathArrayIterator.cs
- XmlSchemaSequence.cs
- CryptographicAttribute.cs
- BindingFormattingDialog.cs
- ParameterToken.cs
- NamedPermissionSet.cs
- Rotation3DAnimation.cs
- WindowsSolidBrush.cs
- PenContext.cs
- BinaryWriter.cs
- CharKeyFrameCollection.cs
- RemotingException.cs
- GridViewRowEventArgs.cs
- ExtensibleClassFactory.cs
- precedingsibling.cs
- CharStorage.cs
- TimeSpanSecondsConverter.cs
- XamlReader.cs
- FormCollection.cs
- HttpWebResponse.cs
- ResourceLoader.cs
- PeerCollaborationPermission.cs
- ResolveMatches11.cs
- HttpException.cs
- Polyline.cs
- SizeLimitedCache.cs
- ClipboardData.cs
- ComboBoxAutomationPeer.cs
- Vector3DCollection.cs
- SqlFacetAttribute.cs
- Transform3DGroup.cs
- GridItemPattern.cs
- ReliableMessagingVersionConverter.cs
- XamlTypeMapperSchemaContext.cs
- OrderablePartitioner.cs
- DataGridViewAccessibleObject.cs
- FontNameConverter.cs
- DbParameterHelper.cs
- SchemaCollectionPreprocessor.cs
- SortableBindingList.cs
- ScrollItemPatternIdentifiers.cs
- SizeValueSerializer.cs
- ShaderEffect.cs
- ServiceHttpModule.cs
- SByte.cs
- SequenceNumber.cs
- ConcatQueryOperator.cs
- UriSection.cs
- Convert.cs
- WebPartVerbsEventArgs.cs
- HttpResponseWrapper.cs
- ProcessHostConfigUtils.cs
- ChangeTracker.cs
- CommandEventArgs.cs
- Html32TextWriter.cs
- ConnectionConsumerAttribute.cs
- Control.cs
- ToolStripSeparatorRenderEventArgs.cs
- CustomError.cs
- X509CertificateStore.cs
- GenericsInstances.cs
- HostingEnvironmentSection.cs
- XmlSchemaAnnotation.cs
- WindowsListViewGroupSubsetLink.cs
- Transform3DCollection.cs
- HttpCachePolicy.cs
- Menu.cs
- ClientData.cs
- VirtualPathProvider.cs
- SizeAnimationBase.cs
- PropertyValueChangedEvent.cs
- XmlDataProvider.cs
- EntryIndex.cs
- ChangeProcessor.cs
- ConfigsHelper.cs
- SmtpLoginAuthenticationModule.cs
- XPathQilFactory.cs
- CachingParameterInspector.cs
- ExcCanonicalXml.cs
- WebPartTracker.cs
- LinkGrep.cs
- CodePageUtils.cs
- WsdlBuildProvider.cs
- TextDecoration.cs
- EntityModelSchemaGenerator.cs
- BaseCodePageEncoding.cs
- TemplatePropertyEntry.cs
- PenCursorManager.cs
- SqlWebEventProvider.cs
- GetWinFXPath.cs
- StructuredCompositeActivityDesigner.cs
- XmlValueConverter.cs
- FillBehavior.cs
- HttpValueCollection.cs
- EventWaitHandle.cs
- SafeProcessHandle.cs
- BitmapCacheBrush.cs
- SimpleRecyclingCache.cs
- RangeValueProviderWrapper.cs