Share via


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
Assembly:  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
Public NotInheritable Class FeatureCollection _
    Inherits ClientObjectCollection(Of Feature)
'Usage
Dim instance As FeatureCollection
public sealed 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