Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- DocumentsTrace.cs
- SafeNativeMethods.cs
- SQLBinary.cs
- DataBindingValueUIHandler.cs
- HMACSHA384.cs
- XmlUtil.cs
- RoutedEventArgs.cs
- StyleTypedPropertyAttribute.cs
- DbUpdateCommandTree.cs
- ColorTranslator.cs
- TableHeaderCell.cs
- IdleTimeoutMonitor.cs
- RemoteTokenFactory.cs
- ConfigurationPropertyCollection.cs
- PatternMatcher.cs
- DesignTimeTemplateParser.cs
- LogicalExpr.cs
- WhitespaceSignificantCollectionAttribute.cs
- AssemblyInfo.cs
- Pen.cs
- XmlAttributeAttribute.cs
- ServicePointManagerElement.cs
- EditorZoneBase.cs
- WindowsListBox.cs
- ImageMap.cs
- IxmlLineInfo.cs
- ObsoleteAttribute.cs
- C14NUtil.cs
- SmtpNetworkElement.cs
- SymLanguageType.cs
- ParameterInfo.cs
- DictionaryBase.cs
- GroupItem.cs
- DependsOnAttribute.cs
- SmiMetaData.cs
- SourceElementsCollection.cs
- Mutex.cs
- SortKey.cs
- ColorMatrix.cs
- ProxyElement.cs
- BamlBinaryReader.cs
- StorageBasedPackageProperties.cs
- CngAlgorithm.cs
- NodeLabelEditEvent.cs
- TdsParserStateObject.cs
- TableChangeProcessor.cs
- Compiler.cs
- GlyphTypeface.cs
- COM2Properties.cs
- SecurityTokenSpecification.cs
- OdbcHandle.cs
- TextSchema.cs
- FileRecordSequenceHelper.cs
- RouteItem.cs
- MenuItemCollection.cs
- OdbcException.cs
- ListBoxAutomationPeer.cs
- DeclarationUpdate.cs
- TextProperties.cs
- PcmConverter.cs
- OutKeywords.cs
- PrefixQName.cs
- SqlBulkCopyColumnMapping.cs
- LogEntrySerializationException.cs
- XmlCompatibilityReader.cs
- CalendarDay.cs
- AppLevelCompilationSectionCache.cs
- unsafeIndexingFilterStream.cs
- QueryStringParameter.cs
- SolidColorBrush.cs
- VSWCFServiceContractGenerator.cs
- SudsParser.cs
- TraceUtils.cs
- SqlFunctions.cs
- ResourceAssociationSetEnd.cs
- XmlReaderSettings.cs
- HttpCachePolicyWrapper.cs
- SchemaLookupTable.cs
- _ContextAwareResult.cs
- MulticastDelegate.cs
- RecognizerBase.cs
- SHA512.cs
- SmiEventStream.cs
- NCryptNative.cs
- MachineKeySection.cs
- ReachSerializationCacheItems.cs
- TemplateBindingExtension.cs
- ConnectionStringsExpressionBuilder.cs
- AnnotationStore.cs
- DockAndAnchorLayout.cs
- EndpointReference.cs
- TextFormatterContext.cs
- ClientSection.cs
- CodeCastExpression.cs
- XmlSchemaChoice.cs
- PathData.cs
- MoveSizeWinEventHandler.cs
- ActivitiesCollection.cs
- LookupBindingPropertiesAttribute.cs
- MasterPageParser.cs