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
- EditorPartChrome.cs
- MessageFilterException.cs
- ADConnectionHelper.cs
- TdsParserSessionPool.cs
- GacUtil.cs
- BooleanKeyFrameCollection.cs
- CustomAttributeSerializer.cs
- HttpConfigurationSystem.cs
- LineServicesRun.cs
- StrongNameKeyPair.cs
- SiteMapNodeItemEventArgs.cs
- MultiDataTrigger.cs
- FileLevelControlBuilderAttribute.cs
- PageBreakRecord.cs
- CheckBox.cs
- Base64Stream.cs
- DiscoveryClientChannelBase.cs
- indexingfiltermarshaler.cs
- BindingExpressionUncommonField.cs
- BaseServiceProvider.cs
- NetCodeGroup.cs
- ClientScriptItemCollection.cs
- RestClientProxyHandler.cs
- ResourcesChangeInfo.cs
- DllNotFoundException.cs
- OdbcCommandBuilder.cs
- SqlHelper.cs
- SurrogateSelector.cs
- Menu.cs
- SymDocumentType.cs
- FlowStep.cs
- CompletedAsyncResult.cs
- followingquery.cs
- ModuleBuilderData.cs
- CacheRequest.cs
- TaskDesigner.cs
- EditorZone.cs
- CollectionBase.cs
- PartBasedPackageProperties.cs
- CapabilitiesSection.cs
- ObjectListDesigner.cs
- NoneExcludedImageIndexConverter.cs
- PeerNameRecord.cs
- ActiveXMessageFormatter.cs
- SerialPort.cs
- TypeSystemHelpers.cs
- HMACMD5.cs
- ExpressionBinding.cs
- FileFormatException.cs
- SliderAutomationPeer.cs
- WebPartEventArgs.cs
- AsyncResult.cs
- TableRow.cs
- SqlBuffer.cs
- PublisherIdentityPermission.cs
- InternalControlCollection.cs
- CodeGeneratorOptions.cs
- UserInitiatedNavigationPermission.cs
- XmlSerializerOperationGenerator.cs
- CatalogZoneBase.cs
- DBConnectionString.cs
- AlignmentXValidation.cs
- ProviderConnectionPointCollection.cs
- EventBookmark.cs
- TraceRecord.cs
- SqlFunctionAttribute.cs
- TextParagraphCache.cs
- BaseTemplateBuildProvider.cs
- Shape.cs
- Command.cs
- _SSPIWrapper.cs
- SafeBitVector32.cs
- ResourceProviderFactory.cs
- MenuItem.cs
- ImageSource.cs
- ModuleBuilderData.cs
- GuidConverter.cs
- VariableValue.cs
- SchemaTableOptionalColumn.cs
- GenericsInstances.cs
- XhtmlBasicTextBoxAdapter.cs
- SharedPersonalizationStateInfo.cs
- KeyValuePair.cs
- SettingsPropertyValueCollection.cs
- DataShape.cs
- HttpResponseHeader.cs
- InfoCardSymmetricAlgorithm.cs
- ColorConvertedBitmap.cs
- LoginView.cs
- LocatorPart.cs
- LocalizationParserHooks.cs
- Int32EqualityComparer.cs
- EncryptedPackageFilter.cs
- HwndStylusInputProvider.cs
- WorkflowValidationFailedException.cs
- SortAction.cs
- HandleCollector.cs
- MethodAccessException.cs
- SQLStringStorage.cs
- OdbcReferenceCollection.cs