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
- XmlFormatExtensionPrefixAttribute.cs
- updatecommandorderer.cs
- IImplicitResourceProvider.cs
- RecognizerStateChangedEventArgs.cs
- TypeLoadException.cs
- MSG.cs
- ToolStripItemEventArgs.cs
- PersonalizationProvider.cs
- ConnectionManagementSection.cs
- CodeStatement.cs
- FileUtil.cs
- FontStretches.cs
- DataGridColumnCollection.cs
- CodeFieldReferenceExpression.cs
- IconBitmapDecoder.cs
- panel.cs
- HtmlInputPassword.cs
- ResourceReferenceExpressionConverter.cs
- DataSourceControl.cs
- TableLayoutRowStyleCollection.cs
- DependencySource.cs
- ClosableStream.cs
- GlobalDataBindingHandler.cs
- ClientFormsAuthenticationCredentials.cs
- DeviceContext.cs
- XmlDataSourceNodeDescriptor.cs
- Cursors.cs
- ZipIOLocalFileBlock.cs
- printdlgexmarshaler.cs
- MobileControlsSection.cs
- SecureUICommand.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- BindingsCollection.cs
- Registry.cs
- TextContainerChangedEventArgs.cs
- TextServicesPropertyRanges.cs
- CodeMemberField.cs
- SettingsBindableAttribute.cs
- AmbientLight.cs
- __ConsoleStream.cs
- DeferredReference.cs
- XsdValidatingReader.cs
- SmtpDateTime.cs
- DiscoveryClientOutputChannel.cs
- SelectorAutomationPeer.cs
- httpstaticobjectscollection.cs
- CodeAccessPermission.cs
- SelectionRangeConverter.cs
- SchemaElementLookUpTableEnumerator.cs
- Table.cs
- XsdDuration.cs
- CustomCredentialPolicy.cs
- WebPartEditorApplyVerb.cs
- XsdDateTime.cs
- OrderByQueryOptionExpression.cs
- ExpressionNode.cs
- ModelItemCollectionImpl.cs
- RuntimeHelpers.cs
- SspiWrapper.cs
- CodeDelegateCreateExpression.cs
- BufferedStream.cs
- OrderedDictionaryStateHelper.cs
- WinEventQueueItem.cs
- Latin1Encoding.cs
- ConditionalBranch.cs
- ProcessModule.cs
- TextSerializer.cs
- ResourceAssociationSetEnd.cs
- TextElement.cs
- mansign.cs
- DelegatedStream.cs
- MergeLocalizationDirectives.cs
- XamlContextStack.cs
- WebBaseEventKeyComparer.cs
- TransformPattern.cs
- _CommandStream.cs
- ServiceNameCollection.cs
- ProxyHwnd.cs
- GroupDescription.cs
- Message.cs
- AssemblyNameProxy.cs
- ObjectMemberMapping.cs
- UseManagedPresentationBindingElement.cs
- ControlAdapter.cs
- XNodeValidator.cs
- SignatureGenerator.cs
- SessionEndedEventArgs.cs
- HitTestWithPointDrawingContextWalker.cs
- RuleSetDialog.cs
- MarginCollapsingState.cs
- PropertyGridEditorPart.cs
- XmlReaderDelegator.cs
- SwitchDesigner.xaml.cs
- XmlToDatasetMap.cs
- TextEndOfLine.cs
- CommandPlan.cs
- AliasedExpr.cs
- XmlDownloadManager.cs
- FullTextLine.cs
- CheckBoxStandardAdapter.cs