Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / AddIn / AddIn / System / Addin / Pipeline / CollectionAdapters.cs / 1305376 / CollectionAdapters.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: CollectionAdapters ** ** Purpose: Provides methods to convert from IListto IListContract ** and vice versa. ** ===========================================================*/ using System; using System.Collections.Generic; using System.AddIn.Contract; using System.AddIn; namespace System.AddIn.Pipeline { public static class CollectionAdapters { // Create a IListContract wrapper for an IList. This is typically done // by an addin adapter that wants to pass a list of objects to the host, // or vice versa. public static IListContract ToIListContract ( IList collection, Converter viewContractAdapter, Converter contractViewAdapter) { if (collection == null) return null; return new ListContractAdapter (collection, viewContractAdapter, contractViewAdapter); } public static IListContract ToIListContract (IList collection) { if (collection == null) return null; Converter c = new Converter (IdentityConverter ); return ToIListContract(collection, c, c); } // Create an IList that wraps a IContractList. The returned IList will // have a lifetimeToken for the remote IContractList. Its finalizer // will revoke the lifetimeToken. public static IList ToIList ( IListContract collection, Converter contractViewAdapter, Converter viewContractAdapter) { if (collection == null) return null; return new ContractListAdapter (collection, contractViewAdapter, viewContractAdapter); } public static IList ToIList (IListContract collection) { if (collection == null) return null; Converter c = new Converter (IdentityConverter ); return ToIList(collection, c, c); } private static T IdentityConverter (T item) { return item; } } } // 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
- MultiDataTrigger.cs
- View.cs
- FtpCachePolicyElement.cs
- CommonXSendMessage.cs
- PrivilegeNotHeldException.cs
- RegularExpressionValidator.cs
- HtmlTableCellCollection.cs
- UserControlParser.cs
- MdiWindowListItemConverter.cs
- Utils.cs
- BamlLocalizabilityResolver.cs
- WebRequestModulesSection.cs
- UndoEngine.cs
- DesignerSerializationVisibilityAttribute.cs
- Misc.cs
- ControlIdConverter.cs
- BitStack.cs
- Action.cs
- ConfigurationStrings.cs
- HashCodeCombiner.cs
- DetailsViewModeEventArgs.cs
- FormClosedEvent.cs
- CompareValidator.cs
- ObjectStateFormatter.cs
- figurelengthconverter.cs
- WindowsFormsHost.cs
- mediaeventargs.cs
- TextReader.cs
- ProviderCollection.cs
- DataKey.cs
- InvalidDataException.cs
- ImageClickEventArgs.cs
- HostProtectionException.cs
- DataSet.cs
- StorageBasedPackageProperties.cs
- ModelService.cs
- __TransparentProxy.cs
- ConfigXmlCDataSection.cs
- XslAst.cs
- JournalEntryStack.cs
- Types.cs
- IteratorDescriptor.cs
- adornercollection.cs
- MsmqBindingMonitor.cs
- InstanceLockLostException.cs
- ClientUtils.cs
- Attachment.cs
- HotSpot.cs
- XmlSchemaSimpleTypeRestriction.cs
- SecurityDescriptor.cs
- InplaceBitmapMetadataWriter.cs
- EventSetter.cs
- XhtmlConformanceSection.cs
- VisualStyleRenderer.cs
- TagMapInfo.cs
- CacheVirtualItemsEvent.cs
- ExpressionEditorSheet.cs
- NavigatorOutput.cs
- EdmMember.cs
- ResourceIDHelper.cs
- OperationAbortedException.cs
- PropertyOverridesTypeEditor.cs
- DoubleConverter.cs
- XmlSchemaObjectCollection.cs
- FontInfo.cs
- GeneralTransform.cs
- RegexCapture.cs
- ExportFileRequest.cs
- CommandPlan.cs
- DataGridViewRow.cs
- JapaneseCalendar.cs
- _TimerThread.cs
- DoubleKeyFrameCollection.cs
- RegistryExceptionHelper.cs
- Base64Encoder.cs
- Exceptions.cs
- DependencyObjectProvider.cs
- ProxyGenerationError.cs
- PropertyInfo.cs
- _AutoWebProxyScriptHelper.cs
- sqlstateclientmanager.cs
- WorkflowCompensationBehavior.cs
- StylusPoint.cs
- ResourceDisplayNameAttribute.cs
- DataBinding.cs
- ParserOptions.cs
- Pair.cs
- SqlGatherProducedAliases.cs
- ExpanderAutomationPeer.cs
- BufferedGraphicsContext.cs
- SelectedGridItemChangedEvent.cs
- xml.cs
- _Win32.cs
- Int16.cs
- serverconfig.cs
- SessionState.cs
- TextBoxRenderer.cs
- SchemaImporterExtensionsSection.cs
- InlineUIContainer.cs
- Array.cs