다음을 통해 공유


FeatureCollection Class

Represents a collection of SPFeature objects.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Client.ClientObject
    Microsoft.SharePoint.Client.ClientObjectCollection
      Microsoft.SharePoint.Client.ClientObjectCollection<Feature>
        Microsoft.SharePoint.Client.FeatureCollection

Namespace:  Microsoft.SharePoint.Client
Assemblies:   Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
<ScriptTypeAttribute("SP.FeatureCollection", ServerTypeId := "{8b9c0015-193d-4062-8e98-8d23c303eedd}")> _
Public Class FeatureCollection _
    Inherits ClientObjectCollection(Of Feature)
'Usage
Dim instance As FeatureCollection
[ScriptTypeAttribute("SP.FeatureCollection", ServerTypeId = "{8b9c0015-193d-4062-8e98-8d23c303eedd}")]
public class FeatureCollection : ClientObjectCollection<Feature>

Examples

This code example displays the identifiers of the current website’s active features.

using System;
using Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointFoundation.Samples
{
    class FeatureCollectionExample
    {
        static void Main()
        {

            string siteUrl = "http://MyServer/sites/MySiteCollection";

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;
            FeatureCollection collFeature = site.Features;

            clientContext.Load(collFeature);
            clientContext.ExecuteQuery();

            foreach (Feature oneFeature in collFeature)
               Console.WriteLine("Feature ID: {0}", oneFeature.DefinitionId);
        }

    }
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

FeatureCollection Members

Microsoft.SharePoint.Client Namespace