Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / System / Windows / Markup / ServiceProviders.cs / 1305600 / ServiceProviders.cs
//---------------------------------------------------------------------------- // // File: ServiceProviders.cs // // Description: // Proivde a implementation for IServiceProvider and method to add services // // Copyright (C) 2003 by Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.ComponentModel; using System.Collections.Generic; using System.Security.Permissions; using MS.Internal.WindowsBase; ///////////////////////////////////////////////////////////////////////////////////////// namespace System.Windows.Markup { ////// Proivde a implementation for IServiceProvider and method to add services /// ///Restrict public access until M8.2 //CASRemoval:[StrongNameIdentityPermission(SecurityAction.LinkDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] [System.ComponentModel.Browsable(false)] public class ServiceProviders : IServiceProvider { #region Implement IServiceProvider interface ////// Implement IServiceProvider.GetSevice /// /// ///public Object GetService(Type serviceType) { if (_objDict.ContainsKey(serviceType)) { return _objDict[serviceType]; } return null; } #endregion /// /// Add a new service /// /// /// public void AddService(Type serviceType, Object service) { if (serviceType == null) { throw new ArgumentNullException("serviceType"); } if (service == null) { throw new ArgumentNullException("service"); } if (_objDict.ContainsKey(serviceType) == false) { _objDict.Add(serviceType, service); } else if (_objDict[serviceType] != service) { throw new ArgumentException(SR.Get(SRID.ServiceTypeAlreadyAdded), "serviceType"); } } private Dictionary_objDict = new Dictionary (); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TreeSet.cs
- TreeNodeStyle.cs
- __Filters.cs
- BitConverter.cs
- MailMessageEventArgs.cs
- CompositeControl.cs
- DefaultProxySection.cs
- CommandEventArgs.cs
- TableProvider.cs
- DataGridViewSortCompareEventArgs.cs
- querybuilder.cs
- XmlnsDefinitionAttribute.cs
- WebPartRestoreVerb.cs
- MailBnfHelper.cs
- PageAdapter.cs
- HttpModuleCollection.cs
- TabItemAutomationPeer.cs
- AccessibilityApplicationManager.cs
- objectquery_tresulttype.cs
- FlowLayout.cs
- TextTreeTextElementNode.cs
- EffectiveValueEntry.cs
- HttpModulesSection.cs
- ResourceReferenceExpression.cs
- PtsCache.cs
- ListBoxAutomationPeer.cs
- ApplicationSecurityManager.cs
- Int64Storage.cs
- CollectionAdapters.cs
- ArgumentOutOfRangeException.cs
- NativeBuffer.cs
- precedingquery.cs
- FlagsAttribute.cs
- ModelPropertyCollectionImpl.cs
- WorkflowMessageEventArgs.cs
- ComponentGuaranteesAttribute.cs
- SchemaNames.cs
- PKCS1MaskGenerationMethod.cs
- wgx_render.cs
- StatusBarItemAutomationPeer.cs
- BasicAsyncResult.cs
- TemplateControl.cs
- Font.cs
- Closure.cs
- ThreadPool.cs
- OleCmdHelper.cs
- ToolTip.cs
- ConnectionStringSettings.cs
- QueueProcessor.cs
- DataGridToolTip.cs
- MemberRelationshipService.cs
- RoutedEventArgs.cs
- MethodAccessException.cs
- FullTextBreakpoint.cs
- SuppressIldasmAttribute.cs
- SocketCache.cs
- SharedMemory.cs
- RepeatBehaviorConverter.cs
- TypeExtension.cs
- PhysicalFontFamily.cs
- UnicastIPAddressInformationCollection.cs
- QuotaExceededException.cs
- TimelineClockCollection.cs
- LeaseManager.cs
- UdpDiscoveryEndpointElement.cs
- odbcmetadatacolumnnames.cs
- Util.cs
- DataGridViewCellValidatingEventArgs.cs
- EncoderNLS.cs
- EditorPartCollection.cs
- FileLogRecordStream.cs
- LoginView.cs
- HTMLTagNameToTypeMapper.cs
- AuthenticatedStream.cs
- TimelineClockCollection.cs
- WindowsListViewGroup.cs
- SqlDataSourceFilteringEventArgs.cs
- ContractHandle.cs
- cache.cs
- DodSequenceMerge.cs
- MethodBuilder.cs
- CompilerGeneratedAttribute.cs
- CodeTypeReference.cs
- DataFormat.cs
- TrackingRecord.cs
- JsonReaderWriterFactory.cs
- ListBox.cs
- PointHitTestResult.cs
- MonitoringDescriptionAttribute.cs
- ComponentEditorPage.cs
- DynamicActionMessageFilter.cs
- FacetValues.cs
- TextElementCollectionHelper.cs
- KeySpline.cs
- TypeContext.cs
- SecurityTokenResolver.cs
- TdsParser.cs
- RightsManagementManager.cs
- FileLevelControlBuilderAttribute.cs
- TextRunProperties.cs