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
- OrderedDictionary.cs
- TableColumn.cs
- PackageFilter.cs
- CommandSet.cs
- SafeLibraryHandle.cs
- SystemResources.cs
- ClrPerspective.cs
- XmlEnumAttribute.cs
- HMACSHA512.cs
- SystemInfo.cs
- CallbackBehaviorAttribute.cs
- Root.cs
- AppDomainShutdownMonitor.cs
- ArithmeticLiteral.cs
- BooleanAnimationUsingKeyFrames.cs
- XmlObjectSerializerContext.cs
- WebServiceErrorEvent.cs
- LogSwitch.cs
- ScrollEventArgs.cs
- WindowsListViewGroup.cs
- SoapEnumAttribute.cs
- SchemaHelper.cs
- PriorityBindingExpression.cs
- Misc.cs
- ToolStripActionList.cs
- ProjectionAnalyzer.cs
- Rotation3DAnimation.cs
- ParseNumbers.cs
- ImageButton.cs
- Misc.cs
- Convert.cs
- SoapSchemaImporter.cs
- EntityContainer.cs
- listitem.cs
- SqlRecordBuffer.cs
- Assembly.cs
- ToolStripPanelCell.cs
- ConfigXmlAttribute.cs
- HwndAppCommandInputProvider.cs
- TextServicesCompartmentContext.cs
- DependencyObject.cs
- AuthenticationException.cs
- EdmMember.cs
- WorkflowTransactionService.cs
- XmlSchemaAppInfo.cs
- COAUTHINFO.cs
- DataGridViewSelectedRowCollection.cs
- XmlDocumentSerializer.cs
- FlowNode.cs
- DBSchemaTable.cs
- TableItemPattern.cs
- XPathParser.cs
- TableLayoutCellPaintEventArgs.cs
- Transaction.cs
- GPPOINTF.cs
- ManipulationDelta.cs
- WebServicesDescriptionAttribute.cs
- KeyboardDevice.cs
- CollectionExtensions.cs
- DataGridTextBox.cs
- ArgumentValidation.cs
- SqlUdtInfo.cs
- ContextStaticAttribute.cs
- DesignerProperties.cs
- DataDesignUtil.cs
- TimeoutException.cs
- XmlAnyElementAttributes.cs
- PrePrepareMethodAttribute.cs
- PeerName.cs
- DelegatedStream.cs
- CodeAttributeDeclaration.cs
- StringFormat.cs
- SingleConverter.cs
- WebResourceUtil.cs
- InstancePersistenceCommandException.cs
- IsolatedStorageFile.cs
- _ListenerResponseStream.cs
- FieldTemplateFactory.cs
- EntityDataSourceContextCreatingEventArgs.cs
- MediaContextNotificationWindow.cs
- TrustManagerMoreInformation.cs
- RequestBringIntoViewEventArgs.cs
- Axis.cs
- DefaultAuthorizationContext.cs
- ExternalFile.cs
- ConfigurationLockCollection.cs
- TypeReference.cs
- CompatibleComparer.cs
- DtdParser.cs
- DataMisalignedException.cs
- SemanticAnalyzer.cs
- ImageDrawing.cs
- CacheEntry.cs
- DataTableReaderListener.cs
- LoopExpression.cs
- PropertyChangedEventManager.cs
- TreeNode.cs
- ZeroOpNode.cs
- FieldMetadata.cs
- WebPartEditorOkVerb.cs