Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Base / System / Windows / Markup / ServiceProviders.cs / 1 / 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; ///////////////////////////////////////////////////////////////////////////////////////// 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. //---------------------------------------------------------------------------- // // 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; ///////////////////////////////////////////////////////////////////////////////////////// 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
- DependencyPropertyConverter.cs
- EditorPart.cs
- PathHelper.cs
- PackageFilter.cs
- DataBoundControlActionList.cs
- SaveLedgerEntryRequest.cs
- EventLogEntry.cs
- SQLInt32Storage.cs
- FrameworkPropertyMetadata.cs
- HitTestDrawingContextWalker.cs
- TemplateColumn.cs
- OracleCommandSet.cs
- SqlDataSourceStatusEventArgs.cs
- X500Name.cs
- ServiceDeploymentInfo.cs
- HtmlInputPassword.cs
- SqlTrackingQuery.cs
- BulletedListEventArgs.cs
- TimeStampChecker.cs
- SqlNotificationEventArgs.cs
- TextElement.cs
- PropertyValidationContext.cs
- MailDefinition.cs
- ScriptManagerProxy.cs
- ImageListImageEditor.cs
- XamlVector3DCollectionSerializer.cs
- FtpWebRequest.cs
- GPPOINT.cs
- LinkedList.cs
- WebHttpBindingCollectionElement.cs
- DispatcherFrame.cs
- SafeEventLogWriteHandle.cs
- StaticContext.cs
- Queue.cs
- DataSourceNameHandler.cs
- StringWriter.cs
- TemplateControlParser.cs
- WebPartMenuStyle.cs
- Brushes.cs
- DataComponentGenerator.cs
- PropertyConverter.cs
- WorkItem.cs
- StructuredProperty.cs
- RequestCachingSection.cs
- WebServiceData.cs
- DynamicRenderer.cs
- ParagraphResult.cs
- ToolStripItemEventArgs.cs
- LoginUtil.cs
- TrustLevelCollection.cs
- NativeMethods.cs
- XmlReflectionImporter.cs
- FrameSecurityDescriptor.cs
- TextSelectionHelper.cs
- XmlTextAttribute.cs
- ScriptingWebServicesSectionGroup.cs
- DateTimeFormat.cs
- ComplexObject.cs
- TemplatePartAttribute.cs
- BooleanExpr.cs
- AttachmentCollection.cs
- ToggleButtonAutomationPeer.cs
- PropertyFilterAttribute.cs
- TextServicesDisplayAttribute.cs
- BinaryVersion.cs
- SqlTriggerAttribute.cs
- DataException.cs
- FileSystemEventArgs.cs
- MsmqVerifier.cs
- FontWeight.cs
- DescriptionAttribute.cs
- CharEnumerator.cs
- ActivationArguments.cs
- Margins.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- DictionaryEditChange.cs
- TemplateAction.cs
- Debug.cs
- EdgeModeValidation.cs
- BufferedGraphics.cs
- AuthenticationSection.cs
- Light.cs
- SourceItem.cs
- TextTreeFixupNode.cs
- _Events.cs
- HttpRuntime.cs
- IODescriptionAttribute.cs
- OperationResponse.cs
- MailMessageEventArgs.cs
- UiaCoreProviderApi.cs
- CLRBindingWorker.cs
- MatrixConverter.cs
- ExpressionPrinter.cs
- RenderCapability.cs
- FrameworkName.cs
- HttpInputStream.cs
- ValueOfAction.cs
- StrokeNode.cs
- EntityModelSchemaGenerator.cs
- Win32SafeHandles.cs