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
- SessionIDManager.cs
- TextViewElement.cs
- OleDbInfoMessageEvent.cs
- BindingValueChangedEventArgs.cs
- Padding.cs
- Gdiplus.cs
- RenderData.cs
- ThreadAbortException.cs
- MetadataItemEmitter.cs
- PenThread.cs
- ResetableIterator.cs
- StackOverflowException.cs
- IImplicitResourceProvider.cs
- SourceElementsCollection.cs
- MethodBuilder.cs
- CriticalExceptions.cs
- TypeResolver.cs
- DisableDpiAwarenessAttribute.cs
- SqlUdtInfo.cs
- XPathNodeInfoAtom.cs
- CustomError.cs
- DbXmlEnabledProviderManifest.cs
- KerberosRequestorSecurityToken.cs
- DesignTimeParseData.cs
- TypedTableGenerator.cs
- SortKey.cs
- MethodBody.cs
- recordstatefactory.cs
- DatagramAdapter.cs
- SqlClientFactory.cs
- IPHostEntry.cs
- CqlParserHelpers.cs
- SQLInt64.cs
- TraceContext.cs
- BooleanExpr.cs
- SqlDataSourceCache.cs
- TransformPatternIdentifiers.cs
- CaseInsensitiveOrdinalStringComparer.cs
- ReturnEventArgs.cs
- CellLabel.cs
- SmiRecordBuffer.cs
- ParameterRetriever.cs
- CompModSwitches.cs
- WebBrowser.cs
- AlignmentXValidation.cs
- CacheSection.cs
- Int32KeyFrameCollection.cs
- AdPostCacheSubstitution.cs
- OracleCommandBuilder.cs
- oledbconnectionstring.cs
- QEncodedStream.cs
- ParentQuery.cs
- Message.cs
- BindingsCollection.cs
- DiagnosticSection.cs
- HttpModulesSection.cs
- WmlControlAdapter.cs
- CompilationSection.cs
- PropertyItem.cs
- DictionaryTraceRecord.cs
- WebPartCloseVerb.cs
- SelectedGridItemChangedEvent.cs
- TablePatternIdentifiers.cs
- SerializerDescriptor.cs
- TaiwanLunisolarCalendar.cs
- SqlFactory.cs
- InputScope.cs
- RecipientInfo.cs
- HttpRequest.cs
- PathGradientBrush.cs
- ColorTransform.cs
- WebServiceResponse.cs
- x509utils.cs
- TraceContext.cs
- SmtpTransport.cs
- SystemGatewayIPAddressInformation.cs
- GPRECT.cs
- ColorInterpolationModeValidation.cs
- XmlSchemaExporter.cs
- SQLBinary.cs
- SHA512Managed.cs
- MaskDescriptors.cs
- PackageDigitalSignature.cs
- ResXDataNode.cs
- WebBrowserBase.cs
- DropShadowEffect.cs
- PassportAuthenticationModule.cs
- LocalizableResourceBuilder.cs
- XmlElementAttributes.cs
- HttpHandlerActionCollection.cs
- TypedTableBaseExtensions.cs
- jithelpers.cs
- ListBindableAttribute.cs
- XhtmlTextWriter.cs
- CalendarTable.cs
- XhtmlStyleClass.cs
- ProviderConnectionPointCollection.cs
- RotateTransform3D.cs
- EmbeddedMailObjectCollectionEditor.cs
- ViewValidator.cs