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
- CollectionBuilder.cs
- TextElementCollectionHelper.cs
- ScrollBar.cs
- TextParentUndoUnit.cs
- TagMapInfo.cs
- TemplateField.cs
- PropertyChangedEventManager.cs
- QilList.cs
- MdImport.cs
- ComponentRenameEvent.cs
- RolePrincipal.cs
- TextEditorMouse.cs
- FontEmbeddingManager.cs
- Message.cs
- MenuBindingsEditorForm.cs
- DbgUtil.cs
- HighContrastHelper.cs
- RefreshEventArgs.cs
- CheckableControlBaseAdapter.cs
- MailDefinition.cs
- StringKeyFrameCollection.cs
- EntityDataSourceColumn.cs
- ResizeGrip.cs
- LayoutTableCell.cs
- XamlDesignerSerializationManager.cs
- Baml6ConstructorInfo.cs
- IndicCharClassifier.cs
- RemotingSurrogateSelector.cs
- GridItem.cs
- HostVisual.cs
- ExceptionHelpers.cs
- XslTransform.cs
- PeerApplicationLaunchInfo.cs
- UserPreferenceChangedEventArgs.cs
- OleDbEnumerator.cs
- SerialReceived.cs
- RecognizerBase.cs
- MailAddress.cs
- OpenTypeLayoutCache.cs
- SpecularMaterial.cs
- TreeNodeBindingCollection.cs
- ControlPaint.cs
- CompilerError.cs
- Label.cs
- SoapConverter.cs
- CheckBox.cs
- InitializingNewItemEventArgs.cs
- AppSettings.cs
- TreeBuilder.cs
- Propagator.cs
- ConfigXmlCDataSection.cs
- BitmapEffectDrawingContextWalker.cs
- TextBox.cs
- Validator.cs
- SiteMapNode.cs
- SmiEventSink.cs
- DataGrid.cs
- DesignTimeTemplateParser.cs
- XDeferredAxisSource.cs
- ButtonBaseAutomationPeer.cs
- TraceRecord.cs
- DesignerLoader.cs
- TraceEventCache.cs
- ObjectStateEntry.cs
- MenuItemStyleCollection.cs
- InputDevice.cs
- TextTreeNode.cs
- RegexStringValidatorAttribute.cs
- PropertySegmentSerializer.cs
- LassoHelper.cs
- DropShadowEffect.cs
- CancelEventArgs.cs
- SoapProtocolReflector.cs
- IsolatedStorageFileStream.cs
- NativeBuffer.cs
- HtmlObjectListAdapter.cs
- FormViewUpdateEventArgs.cs
- Script.cs
- RequestQueryProcessor.cs
- CompilerError.cs
- WebPartPersonalization.cs
- WinFormsSecurity.cs
- FullTextState.cs
- BeginStoryboard.cs
- Module.cs
- ParameterReplacerVisitor.cs
- ConnectionConsumerAttribute.cs
- SqlBooleanizer.cs
- ListSourceHelper.cs
- TreeNodeMouseHoverEvent.cs
- RenamedEventArgs.cs
- ImageSourceValueSerializer.cs
- PriorityQueue.cs
- DesignerLabelAdapter.cs
- BinaryMethodMessage.cs
- BooleanAnimationUsingKeyFrames.cs
- MappingItemCollection.cs
- IpcChannelHelper.cs
- Win32.cs
- MouseGesture.cs