Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / AddIn / AddIn / System / Addin / Hosting / Store / ContractComponent.cs / 1305376 / ContractComponent.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: ContractComponent ** ** Purpose: Represents a class that implements IContract on ** disk, for the add-in model. ** ===========================================================*/ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Text; using System.AddIn.MiniReflection; using System.Diagnostics.Contracts; namespace System.AddIn { [Serializable] internal sealed class ContractComponent : PipelineComponent { public ContractComponent(TypeInfo typeInfo, String assemblyLocation) : base(typeInfo, assemblyLocation) { } public override string ToString() { return String.Format(CultureInfo.CurrentCulture, Res.ContractToString, Name, BestAvailableLocation); } internal override bool Validate(Type type, Collectionwarnings) { //if (!type.Implements(new TypeInfo(typeof(IContract)))) if (!IContractInReflectionLoaderContext.IsAssignableFrom(type)) { warnings.Add(String.Format(CultureInfo.CurrentCulture, Res.ContractMustImplementIContract, Name)); return false; } if (!type.IsInterface) { warnings.Add(String.Format(CultureInfo.CurrentCulture, Res.ContractMustBeInterface, Name)); return false; } return base.Validate(type, warnings); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: ContractComponent ** ** Purpose: Represents a class that implements IContract on ** disk, for the add-in model. ** ===========================================================*/ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Text; using System.AddIn.MiniReflection; using System.Diagnostics.Contracts; namespace System.AddIn { [Serializable] internal sealed class ContractComponent : PipelineComponent { public ContractComponent(TypeInfo typeInfo, String assemblyLocation) : base(typeInfo, assemblyLocation) { } public override string ToString() { return String.Format(CultureInfo.CurrentCulture, Res.ContractToString, Name, BestAvailableLocation); } internal override bool Validate(Type type, Collection warnings) { //if (!type.Implements(new TypeInfo(typeof(IContract)))) if (!IContractInReflectionLoaderContext.IsAssignableFrom(type)) { warnings.Add(String.Format(CultureInfo.CurrentCulture, Res.ContractMustImplementIContract, Name)); return false; } if (!type.IsInterface) { warnings.Add(String.Format(CultureInfo.CurrentCulture, Res.ContractMustBeInterface, Name)); return false; } return base.Validate(type, warnings); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FrameAutomationPeer.cs
- ConfigXmlElement.cs
- MimeParameter.cs
- ipaddressinformationcollection.cs
- ParameterSubsegment.cs
- Converter.cs
- TriggerBase.cs
- WindowsListBox.cs
- DesignObjectWrapper.cs
- ResXDataNode.cs
- SqlFunctionAttribute.cs
- DataGridViewRowsAddedEventArgs.cs
- Config.cs
- ComponentResourceKey.cs
- EmbeddedMailObjectCollectionEditor.cs
- PropertiesTab.cs
- DataBindingCollectionConverter.cs
- DataGrid.cs
- AgileSafeNativeMemoryHandle.cs
- UIElementParaClient.cs
- LinkedResource.cs
- ImageClickEventArgs.cs
- httpserverutility.cs
- ServicesSection.cs
- FormatSettings.cs
- Comparer.cs
- ListItemCollection.cs
- AutomationProperties.cs
- ProtectedUri.cs
- WebBrowserNavigatedEventHandler.cs
- NetStream.cs
- SqlFormatter.cs
- SqlDataSource.cs
- Helper.cs
- NotImplementedException.cs
- RoleManagerEventArgs.cs
- ActivityExecutorOperation.cs
- ObjectPersistData.cs
- ProxyDataContractResolver.cs
- XmlILOptimizerVisitor.cs
- ContextMenuAutomationPeer.cs
- KeyFrames.cs
- RijndaelManagedTransform.cs
- UnregisterInfo.cs
- CodeComment.cs
- _NestedSingleAsyncResult.cs
- categoryentry.cs
- InheritablePropertyChangeInfo.cs
- XmlDataImplementation.cs
- SafeSystemMetrics.cs
- TreeViewHitTestInfo.cs
- DisplayNameAttribute.cs
- FormatVersion.cs
- BigInt.cs
- SqlCharStream.cs
- Setter.cs
- DesignerProperties.cs
- columnmapfactory.cs
- ReadOnlyNameValueCollection.cs
- MimeWriter.cs
- CaseStatement.cs
- TabPage.cs
- ToolStripDropDownClosingEventArgs.cs
- Effect.cs
- LogFlushAsyncResult.cs
- Baml2006KnownTypes.cs
- StatusBarPanel.cs
- mda.cs
- dataprotectionpermissionattribute.cs
- FormViewCommandEventArgs.cs
- CommandConverter.cs
- OrderPreservingMergeHelper.cs
- DataGridViewSelectedColumnCollection.cs
- DispatchOperation.cs
- DateTimeUtil.cs
- TimerElapsedEvenArgs.cs
- LogManagementAsyncResult.cs
- TemplateNodeContextMenu.cs
- ToolboxBitmapAttribute.cs
- SafeFindHandle.cs
- LoadedOrUnloadedOperation.cs
- ExceptionUtil.cs
- HMACRIPEMD160.cs
- ContainsRowNumberChecker.cs
- TextAnchor.cs
- JavaScriptSerializer.cs
- Int64AnimationBase.cs
- ObjectQueryState.cs
- RequestQueryParser.cs
- WMICapabilities.cs
- MultiAsyncResult.cs
- DebugView.cs
- TextSimpleMarkerProperties.cs
- CustomAssemblyResolver.cs
- SqlNodeTypeOperators.cs
- EnvelopedPkcs7.cs
- ResourcesChangeInfo.cs
- TabControl.cs
- Screen.cs
- PowerModeChangedEventArgs.cs