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
- IDQuery.cs
- AspNetSynchronizationContext.cs
- PinnedBufferMemoryStream.cs
- XmlHierarchyData.cs
- SpoolingTaskBase.cs
- XmlDataCollection.cs
- Model3D.cs
- SourceFileBuildProvider.cs
- StringFunctions.cs
- XmlIlVisitor.cs
- PropertyTabChangedEvent.cs
- CqlQuery.cs
- ListManagerBindingsCollection.cs
- cookiecontainer.cs
- OleDbTransaction.cs
- Group.cs
- Context.cs
- DateTimeParse.cs
- AssemblyFilter.cs
- SrgsElement.cs
- FixedSOMContainer.cs
- TextRangeEdit.cs
- CodeObject.cs
- SrgsSemanticInterpretationTag.cs
- SingleStorage.cs
- EntityDataSourceWrapperCollection.cs
- FileClassifier.cs
- MergeFailedEvent.cs
- ImpersonationContext.cs
- EqualityComparer.cs
- SQLMembershipProvider.cs
- BuildManager.cs
- SmiConnection.cs
- IconConverter.cs
- GrammarBuilder.cs
- externdll.cs
- UnsafeNativeMethods.cs
- ConnectionManagementElementCollection.cs
- IntSecurity.cs
- SectionVisual.cs
- AdapterUtil.cs
- BindingValueChangedEventArgs.cs
- CompositeFontParser.cs
- Operator.cs
- CompressionTracing.cs
- RoutedCommand.cs
- TextFormatterHost.cs
- ViewBase.cs
- DrawingContextDrawingContextWalker.cs
- IPAddressCollection.cs
- SamlAuthorityBinding.cs
- Resources.Designer.cs
- SqlDataSourceParameterParser.cs
- ScrollItemPatternIdentifiers.cs
- NativeMethodsOther.cs
- BitmapImage.cs
- ParamArrayAttribute.cs
- SqlSupersetValidator.cs
- ElementFactory.cs
- HashCodeCombiner.cs
- NonParentingControl.cs
- CodeAccessSecurityEngine.cs
- RawStylusInputReport.cs
- ZoneMembershipCondition.cs
- StylusPointProperty.cs
- PackWebRequestFactory.cs
- FilterEventArgs.cs
- DynamicRendererThreadManager.cs
- LocalizationComments.cs
- ParameterRefs.cs
- AdjustableArrowCap.cs
- MetadataItemEmitter.cs
- ProfileGroupSettings.cs
- TableItemStyle.cs
- JournalNavigationScope.cs
- AnnotationResource.cs
- RotateTransform.cs
- Material.cs
- WindowShowOrOpenTracker.cs
- Pointer.cs
- ProgressBarAutomationPeer.cs
- FixedSOMLineCollection.cs
- NullExtension.cs
- WaitingCursor.cs
- MultiPropertyDescriptorGridEntry.cs
- HtmlUtf8RawTextWriter.cs
- SqlConnectionString.cs
- SeekStoryboard.cs
- HyperLinkStyle.cs
- SQLInt16.cs
- ExpandableObjectConverter.cs
- RawStylusInputCustomData.cs
- DataPagerField.cs
- SignatureToken.cs
- GlyphInfoList.cs
- RoleGroupCollection.cs
- PagesChangedEventArgs.cs
- BindableAttribute.cs
- FillErrorEventArgs.cs
- TimeSpanOrInfiniteValidator.cs