Code:
/ 4.0 / 4.0 / 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, FunctypeNameConverter) { 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. //------------------------------------------------------------------------------ // // 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, FunctypeNameConverter) { 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
- FontFamilyValueSerializer.cs
- HashAlgorithm.cs
- XPathArrayIterator.cs
- MenuAdapter.cs
- UnsignedPublishLicense.cs
- TypeConverterHelper.cs
- CharEntityEncoderFallback.cs
- AssemblyName.cs
- GradientStop.cs
- ReadOnlyCollection.cs
- SafeMarshalContext.cs
- DefaultTextStoreTextComposition.cs
- Exceptions.cs
- BuildProvider.cs
- EntityChangedParams.cs
- ListViewGroupItemCollection.cs
- SecUtil.cs
- _DomainName.cs
- Dynamic.cs
- LambdaCompiler.cs
- latinshape.cs
- TimeSpanConverter.cs
- ClusterRegistryConfigurationProvider.cs
- DocumentViewerConstants.cs
- AllMembershipCondition.cs
- TextSelectionHelper.cs
- LinqDataSource.cs
- NameSpaceEvent.cs
- ErrorEventArgs.cs
- SHA1.cs
- StylusPointCollection.cs
- SqlDataSource.cs
- RootProjectionNode.cs
- SplitterPanel.cs
- DefaultParameterValueAttribute.cs
- RefExpr.cs
- AuthenticationSection.cs
- LinkAreaEditor.cs
- elementinformation.cs
- TabControlCancelEvent.cs
- DataError.cs
- SID.cs
- PackageDigitalSignatureManager.cs
- GridItemProviderWrapper.cs
- PopOutPanel.cs
- ByteConverter.cs
- ContainerParagraph.cs
- MonthCalendarDesigner.cs
- NullableLongAverageAggregationOperator.cs
- BlurBitmapEffect.cs
- ButtonField.cs
- FileEnumerator.cs
- ToolStripRendererSwitcher.cs
- HtmlTableCell.cs
- ListComponentEditor.cs
- LineServicesRun.cs
- ServiceX509SecurityTokenProvider.cs
- Parallel.cs
- QilInvokeLateBound.cs
- QilPatternVisitor.cs
- MetadataLocation.cs
- TableParagraph.cs
- X509SecurityTokenAuthenticator.cs
- FormViewAutoFormat.cs
- DependencyObjectType.cs
- AnalyzedTree.cs
- NavigationPropertyEmitter.cs
- LayoutUtils.cs
- Win32KeyboardDevice.cs
- DataGridViewRowConverter.cs
- DataTableNewRowEvent.cs
- CompatibleIComparer.cs
- BindingContext.cs
- WorkflowApplicationAbortedException.cs
- metrodevice.cs
- BaseDataBoundControl.cs
- ChildrenQuery.cs
- TripleDESCryptoServiceProvider.cs
- AdornedElementPlaceholder.cs
- ChangePassword.cs
- DefaultPropertiesToSend.cs
- PointAnimationBase.cs
- StrokeSerializer.cs
- SimpleLine.cs
- DesigntimeLicenseContextSerializer.cs
- FileSystemWatcher.cs
- DataGridPagerStyle.cs
- PostBackOptions.cs
- COAUTHIDENTITY.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- ImageDrawing.cs
- storepermission.cs
- basevalidator.cs
- FileDialog.cs
- AppSettingsExpressionEditor.cs
- CategoryList.cs
- QueryFunctions.cs
- TransformGroup.cs
- WebHttpSecurityModeHelper.cs
- NumberAction.cs