Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ResourcePool.cs
- WebPartAuthorizationEventArgs.cs
- InvalidMessageContractException.cs
- PermissionSetTriple.cs
- UnsafeNativeMethods.cs
- DeclarativeCatalogPart.cs
- WorkflowTraceTransfer.cs
- WinEventQueueItem.cs
- DbgUtil.cs
- DbConnectionClosed.cs
- PreviewPrintController.cs
- XmlWriterSettings.cs
- _ListenerResponseStream.cs
- ConstantCheck.cs
- MetadataArtifactLoaderFile.cs
- XmlHierarchyData.cs
- WebPartAuthorizationEventArgs.cs
- SqlError.cs
- Column.cs
- DbMetaDataCollectionNames.cs
- DateTimeFormatInfoScanner.cs
- SqlDataSourceCommandParser.cs
- ChannelDispatcherCollection.cs
- ToolStripHighContrastRenderer.cs
- WebPartTransformerAttribute.cs
- ItemCheckedEvent.cs
- ExeConfigurationFileMap.cs
- Executor.cs
- XamlReaderHelper.cs
- AuthenticationException.cs
- UInt64.cs
- PeerCustomResolverSettings.cs
- NonVisualControlAttribute.cs
- WSFederationHttpBinding.cs
- RichTextBoxConstants.cs
- ListViewItemSelectionChangedEvent.cs
- DocumentEventArgs.cs
- OdbcReferenceCollection.cs
- DataSourceComponent.cs
- CardSpaceSelector.cs
- PriorityChain.cs
- PageCatalogPart.cs
- Underline.cs
- DefaultEvaluationContext.cs
- HashJoinQueryOperatorEnumerator.cs
- SpellerHighlightLayer.cs
- WebServiceMethodData.cs
- DesignTimeSiteMapProvider.cs
- TextEditorSpelling.cs
- DbCommandTree.cs
- TreeViewItem.cs
- ListBox.cs
- SettingsPropertyCollection.cs
- OraclePermissionAttribute.cs
- XamlReaderConstants.cs
- WebPartDescriptionCollection.cs
- HtmlContainerControl.cs
- WindowManager.cs
- StringComparer.cs
- Rules.cs
- QueryLifecycle.cs
- UidManager.cs
- CqlWriter.cs
- User.cs
- XmlElementList.cs
- StatusBar.cs
- SystemInfo.cs
- EnvironmentPermission.cs
- DoubleCollectionConverter.cs
- MSAAEventDispatcher.cs
- HostSecurityManager.cs
- ViewManager.cs
- KeySpline.cs
- NativeMethods.cs
- MailWebEventProvider.cs
- NativeMethods.cs
- FormsAuthenticationUser.cs
- TransportConfigurationTypeElement.cs
- OracleCommandSet.cs
- WCFServiceClientProxyGenerator.cs
- HasRunnableWorkflowEvent.cs
- GlobalProxySelection.cs
- BoolExpression.cs
- ImageDrawing.cs
- SqlTrackingQuery.cs
- DataGridViewLayoutData.cs
- RuntimeHelpers.cs
- RegistrationServices.cs
- ClassHandlersStore.cs
- RequestQueryParser.cs
- BackStopAuthenticationModule.cs
- CheckBoxBaseAdapter.cs
- DeferredElementTreeState.cs
- EventBuilder.cs
- HttpFileCollection.cs
- SoapObjectReader.cs
- EntityDesignPluralizationHandler.cs
- BinaryConverter.cs
- MethodBody.cs
- XmlSiteMapProvider.cs