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
- CallbackValidatorAttribute.cs
- KeyPullup.cs
- HttpApplicationFactory.cs
- DocumentSchemaValidator.cs
- QueryAsyncResult.cs
- DataSourceCacheDurationConverter.cs
- ServicesUtilities.cs
- Point3DAnimationBase.cs
- EmptyReadOnlyDictionaryInternal.cs
- WebPartMenu.cs
- PrivilegedConfigurationManager.cs
- XmlDocumentFragment.cs
- NavigationWindowAutomationPeer.cs
- VisualStyleInformation.cs
- Message.cs
- DataError.cs
- PeerTransportListenAddressConverter.cs
- Size3D.cs
- HtmlInputText.cs
- BitmapEffectState.cs
- ServiceOperationParameter.cs
- JsonWriter.cs
- XamlPathDataSerializer.cs
- CodeAttributeArgumentCollection.cs
- ServiceObjectContainer.cs
- OperationCanceledException.cs
- XmlSchemaAttributeGroup.cs
- NameSpaceEvent.cs
- FileLogRecordHeader.cs
- PasswordBoxAutomationPeer.cs
- CacheAxisQuery.cs
- DBDataPermission.cs
- InvokeFunc.cs
- DataBindingExpressionBuilder.cs
- ConfigurationSectionGroupCollection.cs
- FixedPageProcessor.cs
- Pointer.cs
- RelationshipType.cs
- Token.cs
- SerializationStore.cs
- RpcCryptoRequest.cs
- Scene3D.cs
- ControlParser.cs
- Fonts.cs
- DesignerPerfEventProvider.cs
- CodeTypeMemberCollection.cs
- Util.cs
- WeakEventManager.cs
- ClientBuildManagerCallback.cs
- RemoteWebConfigurationHost.cs
- WindowsSysHeader.cs
- GZipStream.cs
- CompiledRegexRunner.cs
- IdleTimeoutMonitor.cs
- DataFormats.cs
- HtmlEncodedRawTextWriter.cs
- XmlSchemaType.cs
- Constants.cs
- ObservableDictionary.cs
- HttpBindingExtension.cs
- XmlConverter.cs
- Menu.cs
- serverconfig.cs
- WebServiceErrorEvent.cs
- ToolStripPanelRow.cs
- Int32RectValueSerializer.cs
- PackageDigitalSignatureManager.cs
- WindowsStatusBar.cs
- QueryComponents.cs
- WebConfigurationManager.cs
- QilExpression.cs
- DeploymentSectionCache.cs
- ListItemParagraph.cs
- SocketException.cs
- TextShapeableCharacters.cs
- ToolStripArrowRenderEventArgs.cs
- DescendantBaseQuery.cs
- ServiceContractGenerationContext.cs
- Vector3DCollection.cs
- PerspectiveCamera.cs
- EventSetter.cs
- SourceLocationProvider.cs
- DataGridItemCollection.cs
- AsyncOperationLifetimeManager.cs
- Errors.cs
- ClientFormsIdentity.cs
- XmlReflectionImporter.cs
- EntityCommandCompilationException.cs
- StaticFileHandler.cs
- URLAttribute.cs
- StateMachineHelpers.cs
- DataServiceStreamProviderWrapper.cs
- StaticContext.cs
- XPathArrayIterator.cs
- PEFileEvidenceFactory.cs
- RowSpanVector.cs
- DesignerHelpers.cs
- SqlBooleanMismatchVisitor.cs
- SiteMapProvider.cs
- CaseInsensitiveComparer.cs