Code:
/ 4.0 / 4.0 / 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.
//----------------------------------------------------------------------------
//
// 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
- InkCanvasSelectionAdorner.cs
- Binding.cs
- DataRecordInternal.cs
- WebHttpBehavior.cs
- SingleAnimationUsingKeyFrames.cs
- XmlConvert.cs
- Part.cs
- _NetworkingPerfCounters.cs
- FileAuthorizationModule.cs
- Selection.cs
- UnsafeNativeMethods.cs
- SystemThemeKey.cs
- TrackBarRenderer.cs
- LocationEnvironment.cs
- StringInfo.cs
- XNodeNavigator.cs
- ServicePointManagerElement.cs
- Effect.cs
- EventToken.cs
- ScriptHandlerFactory.cs
- XhtmlBasicPhoneCallAdapter.cs
- BaseCollection.cs
- ChannelCacheSettings.cs
- Formatter.cs
- RegistrySecurity.cs
- Calendar.cs
- PerfProviderCollection.cs
- SourceFileBuildProvider.cs
- Simplifier.cs
- RadioButton.cs
- CellTreeNodeVisitors.cs
- RectangleGeometry.cs
- CodeTypeReference.cs
- ApplicationProxyInternal.cs
- XPathMessageFilterElementCollection.cs
- SerialReceived.cs
- InfoCardSymmetricCrypto.cs
- RequestSecurityTokenResponseCollection.cs
- ToolStripItemCollection.cs
- LinkedList.cs
- HashCodeCombiner.cs
- XamlSerializerUtil.cs
- SelectionEditingBehavior.cs
- MemberInfoSerializationHolder.cs
- FormsAuthenticationUser.cs
- X509CertificateCollection.cs
- DbProviderServices.cs
- RadioButtonFlatAdapter.cs
- DocobjHost.cs
- BooleanKeyFrameCollection.cs
- NullableFloatMinMaxAggregationOperator.cs
- CreateDataSourceDialog.cs
- RectAnimationUsingKeyFrames.cs
- Connector.cs
- InstanceNameConverter.cs
- ConstraintConverter.cs
- baseaxisquery.cs
- AssemblySettingAttributes.cs
- XmlSerializerAssemblyAttribute.cs
- ShortcutKeysEditor.cs
- DataGridViewComboBoxEditingControl.cs
- Transform3DCollection.cs
- NativeMethods.cs
- HealthMonitoringSectionHelper.cs
- GeometryDrawing.cs
- GridViewRow.cs
- AttributeSetAction.cs
- ECDiffieHellmanPublicKey.cs
- ComponentResourceKeyConverter.cs
- RectValueSerializer.cs
- UnknownWrapper.cs
- Exception.cs
- LayoutInformation.cs
- MouseGestureConverter.cs
- AttachedAnnotationChangedEventArgs.cs
- AuthenticateEventArgs.cs
- OleDbTransaction.cs
- HelpProvider.cs
- Border.cs
- MailDefinition.cs
- DiagnosticsConfigurationHandler.cs
- DLinqColumnProvider.cs
- GeometryModel3D.cs
- ScrollBarRenderer.cs
- HttpsHostedTransportConfiguration.cs
- TableLayoutRowStyleCollection.cs
- KerberosTicketHashIdentifierClause.cs
- TransactedBatchingBehavior.cs
- _ListenerAsyncResult.cs
- XmlTextReaderImpl.cs
- WebBaseEventKeyComparer.cs
- AutomationPropertyInfo.cs
- DBSqlParserColumnCollection.cs
- SecurityHeaderLayout.cs
- ColorTransformHelper.cs
- Point3DCollection.cs
- Int64KeyFrameCollection.cs
- XamlBuildTaskServices.cs
- DecoderFallback.cs
- HMACSHA512.cs