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
- PropertyCondition.cs
- ListBox.cs
- XPathArrayIterator.cs
- FormsAuthenticationModule.cs
- ValidatingCollection.cs
- CodeCatchClauseCollection.cs
- DesignerVerbToolStripMenuItem.cs
- BitmapEffectDrawingContent.cs
- MSAAWinEventWrap.cs
- TimeZone.cs
- WindowsToolbarAsMenu.cs
- BaseValidatorDesigner.cs
- XmlDigitalSignatureProcessor.cs
- TimerElapsedEvenArgs.cs
- SharedDp.cs
- UnsafeNativeMethods.cs
- AttachedPropertyBrowsableAttribute.cs
- DispatcherSynchronizationContext.cs
- ValidatingCollection.cs
- TemplateNameScope.cs
- Claim.cs
- MimeReturn.cs
- TypeResolver.cs
- RowVisual.cs
- TextEditorThreadLocalStore.cs
- TypedAsyncResult.cs
- PageEventArgs.cs
- ChildTable.cs
- AsnEncodedData.cs
- MethodImplAttribute.cs
- InternalCache.cs
- ArrayTypeMismatchException.cs
- ButtonField.cs
- ModelUIElement3D.cs
- UniqueEventHelper.cs
- ListSortDescription.cs
- Timeline.cs
- DesignerActionVerbItem.cs
- XsdDuration.cs
- EventHandlersDesigner.cs
- RegexCode.cs
- WhitespaceRuleLookup.cs
- AlphabetConverter.cs
- HGlobalSafeHandle.cs
- Attributes.cs
- XmlSchemaSimpleContent.cs
- TextBox.cs
- DefaultShape.cs
- EntityKey.cs
- ExpressionNormalizer.cs
- CreateUserErrorEventArgs.cs
- Stackframe.cs
- MetadataFile.cs
- XmlNodeReader.cs
- CompressEmulationStream.cs
- ProcessHostMapPath.cs
- PointConverter.cs
- GCHandleCookieTable.cs
- DataTableClearEvent.cs
- ItemsControl.cs
- ConfigXmlElement.cs
- TextSearch.cs
- ObjectContext.cs
- ListControl.cs
- ContextBase.cs
- LeafCellTreeNode.cs
- MultiView.cs
- DomainUpDown.cs
- ProxyWebPartConnectionCollection.cs
- _CookieModule.cs
- MediaTimeline.cs
- COMException.cs
- SQlBooleanStorage.cs
- KeyTime.cs
- BasePropertyDescriptor.cs
- TransactionFlowElement.cs
- RtfToXamlLexer.cs
- Cursors.cs
- FieldAccessException.cs
- MD5CryptoServiceProvider.cs
- SessionViewState.cs
- SpellerHighlightLayer.cs
- VariantWrapper.cs
- DBCommand.cs
- DataServiceBuildProvider.cs
- DynamicResourceExtensionConverter.cs
- DataPointer.cs
- NavigatorInput.cs
- PnrpPeerResolverElement.cs
- Menu.cs
- SymmetricCryptoHandle.cs
- RegexTypeEditor.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- ImageConverter.cs
- ToolStripCodeDomSerializer.cs
- HttpListenerElement.cs
- ProjectionPathSegment.cs
- RichTextBoxDesigner.cs
- RootAction.cs
- SafeEventLogWriteHandle.cs