Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / UI / TargetControlTypeCache.cs / 1305376 / TargetControlTypeCache.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI { using System; using System.Collections; // Cache TargetControlTypeAttributes to improve performance internal static class TargetControlTypeCache { // Maps Type (extender control) to Type[] (valid target control types) private static readonly Hashtable _targetControlTypeCache = Hashtable.Synchronized(new Hashtable()); public static Type[] GetTargetControlTypes(Type extenderControlType) { Type[] types = (Type[])_targetControlTypeCache[extenderControlType]; if (types == null) { types = GetTargetControlTypesInternal(extenderControlType); _targetControlTypeCache[extenderControlType] = types; } return types; } private static Type[] GetTargetControlTypesInternal(Type extenderControlType) { object[] attrs = extenderControlType.GetCustomAttributes(typeof(TargetControlTypeAttribute), true); Type[] types = new Type[attrs.Length]; for (int i = 0; i < attrs.Length; i++) { types[i] = ((TargetControlTypeAttribute)attrs[i]).TargetControlType; } return types; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI { using System; using System.Collections; // Cache TargetControlTypeAttributes to improve performance internal static class TargetControlTypeCache { // Maps Type (extender control) to Type[] (valid target control types) private static readonly Hashtable _targetControlTypeCache = Hashtable.Synchronized(new Hashtable()); public static Type[] GetTargetControlTypes(Type extenderControlType) { Type[] types = (Type[])_targetControlTypeCache[extenderControlType]; if (types == null) { types = GetTargetControlTypesInternal(extenderControlType); _targetControlTypeCache[extenderControlType] = types; } return types; } private static Type[] GetTargetControlTypesInternal(Type extenderControlType) { object[] attrs = extenderControlType.GetCustomAttributes(typeof(TargetControlTypeAttribute), true); Type[] types = new Type[attrs.Length]; for (int i = 0; i < attrs.Length; i++) { types[i] = ((TargetControlTypeAttribute)attrs[i]).TargetControlType; } return types; } } } // 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
- TraceContext.cs
- EventWaitHandleSecurity.cs
- CustomAttribute.cs
- XpsDigitalSignature.cs
- WebPartMenu.cs
- Oci.cs
- CapabilitiesPattern.cs
- SplitterCancelEvent.cs
- MenuItemStyleCollection.cs
- CodeCompiler.cs
- DesignerWidgets.cs
- ListView.cs
- SymbolPair.cs
- ComboBoxItem.cs
- LogWriteRestartAreaAsyncResult.cs
- SmtpFailedRecipientsException.cs
- KeyPressEvent.cs
- SchemaElementDecl.cs
- CrossSiteScriptingValidation.cs
- WmlSelectionListAdapter.cs
- XmlnsCache.cs
- XPathNavigatorReader.cs
- IndexedEnumerable.cs
- DuplicateWaitObjectException.cs
- ZipPackagePart.cs
- parserscommon.cs
- CqlIdentifiers.cs
- StandardBindingOptionalReliableSessionElement.cs
- ProfileProvider.cs
- PostBackOptions.cs
- WindowCollection.cs
- TextContainerHelper.cs
- WhitespaceRule.cs
- CorrelationValidator.cs
- httpapplicationstate.cs
- Page.cs
- StorageEntityContainerMapping.cs
- safelink.cs
- PropertyManager.cs
- XmlSchemaImport.cs
- SafeNativeMethods.cs
- NamespaceCollection.cs
- SizeAnimationUsingKeyFrames.cs
- CheckedPointers.cs
- IsolatedStorageException.cs
- PriorityBinding.cs
- MessageSecurityOverTcp.cs
- InputProcessorProfilesLoader.cs
- IDReferencePropertyAttribute.cs
- ObjRef.cs
- CompositeScriptReference.cs
- TextShapeableCharacters.cs
- SQLMoney.cs
- XamlParser.cs
- Merger.cs
- SequenceFullException.cs
- IfJoinedCondition.cs
- COAUTHIDENTITY.cs
- XmlStrings.cs
- SoapProcessingBehavior.cs
- FieldValue.cs
- WebPartDisplayModeCancelEventArgs.cs
- BamlRecordReader.cs
- SafeFileMappingHandle.cs
- ContextStaticAttribute.cs
- MenuItem.cs
- MenuAdapter.cs
- assemblycache.cs
- UInt64.cs
- ReflectionUtil.cs
- WrapperEqualityComparer.cs
- IPEndPoint.cs
- InvariantComparer.cs
- EmptyEnumerator.cs
- EntityViewContainer.cs
- PeerNameResolver.cs
- ObjectDesignerDataSourceView.cs
- HandleCollector.cs
- ValidationResult.cs
- PropertyGridView.cs
- EntityModelSchemaGenerator.cs
- Literal.cs
- MappingException.cs
- DataGridViewRowPostPaintEventArgs.cs
- OwnerDrawPropertyBag.cs
- DiscoveryRequestHandler.cs
- DescriptionAttribute.cs
- CheckBoxFlatAdapter.cs
- CqlParser.cs
- ProfilePropertyMetadata.cs
- TextSelectionHighlightLayer.cs
- Viewport3DVisual.cs
- ImageDrawing.cs
- SqlSelectStatement.cs
- BaseValidatorDesigner.cs
- EmptyControlCollection.cs
- ListBoxAutomationPeer.cs
- Imaging.cs
- DataGridViewButtonCell.cs
- Rfc2898DeriveBytes.cs