Baca dalam bahasa Inggris

Bagikan melalui


IEnumWCFReferenceContracts Interface

An enumerator for Windows Communication Foundation (WCF) service contracts.

Namespace:  Microsoft.VisualStudio.WCFReference.Interop
Assembly:  Microsoft.VisualStudio.WCFReference.Interop (in Microsoft.VisualStudio.WCFReference.Interop.dll)

Syntax

'Declaration
<GuidAttribute("A8F120C5-E7DF-465A-A7FB-711805281A3B")> _
Public Interface IEnumWCFReferenceContracts _
    Inherits IEnumerable
[GuidAttribute("A8F120C5-E7DF-465A-A7FB-711805281A3B")]
public interface IEnumWCFReferenceContracts : IEnumerable
[GuidAttribute(L"A8F120C5-E7DF-465A-A7FB-711805281A3B")]
public interface class IEnumWCFReferenceContracts : IEnumerable
[<GuidAttribute("A8F120C5-E7DF-465A-A7FB-711805281A3B")>]
type IEnumWCFReferenceContracts =  
    interface
        interface IEnumerable
    end
public interface IEnumWCFReferenceContracts extends IEnumerable

The IEnumWCFReferenceContracts type exposes the following members.

Methods

  Name Description
Public method Clone Clones this IEnumWCFReferenceContracts interface by creating another instance.
Public method GetEnumerator Returns an enumerator that iterates through a collection. (Inherited from IEnumerable.)
Public method Next Retrieves the next IVsWCFReferenceContract.
Public method Reset Returns the enumerator to its initial state.
Public method Skip Skips a specified number of IVsWCFReferenceContract interfaces.

Top

Remarks

You can get an instance of the interface by using the GetContractsEnumerator method of the IVsWCFReferenceGroup interface.

Examples

The following example demonstrates how to populate a TreeNode with contracts by using the IEnumWCFReferenceContracts enumerator.

/// Enumerates and creates a top level contract node.
private TreeNode EnumerateContracts(IVsWCFReferenceGroup group, bool 
 createDummy)
{
    TreeNode contractsNode = CreateExplorerTreeNode(Resources.EnumContracts,
                                    ExplorerNodeType.Group,
                                    group,
                                    ExplorerNodeType.Contract);
    if (createDummy)
    {
        contractsNode.Nodes.Add("Dummy Node, never to be shown");
        return contractsNode;
    }
    // Enumerate the nodes.
    try
    {
        IEnumWCFReferenceContracts contracts = group.GetContractsEnumerator();
        foreach (IVsWCFReferenceContract contract in contracts)
        {
            contractsNode.Nodes.Add(CreateContractNode(contract));
        }
    }
    catch (Exception ex)
    {
        contractsNode.Nodes.Add(CreateErrorNode(ex));
    }

    return contractsNode;
}

See Also

Reference

Microsoft.VisualStudio.WCFReference.Interop Namespace