SetBuilder Class

Provides the functionality to create immutable sets.

命名空间: Microsoft.AnalysisServices.AdomdServer
程序集: msmgdsrv (in msmgdsrv.dll)

语法

声明
<DefaultMemberAttribute("Item")> _
Public NotInheritable Class SetBuilder
    Implements IDisposable
[DefaultMemberAttribute("Item")] 
public sealed class SetBuilder : IDisposable
[DefaultMemberAttribute(L"Item")] 
public ref class SetBuilder sealed : IDisposable
/** @attribute DefaultMemberAttribute("Item") */ 
public final class SetBuilder implements IDisposable
DefaultMemberAttribute("Item") 
public final class SetBuilder implements IDisposable

Inheritance Hierarchy

System.Object
  Microsoft.AnalysisServices.AdomdServer.SetBuilder

示例

The following example takes a set and a return count, and randomly retrieves tuples from the set, returning a final subset.

public Set RandomSample(Set set, int returnCount)
{
    //Return the original set if there are fewer tuples
    //in the set than the number requested.
    if (set.Tuples.Count <= returnCount)
        return set;

    System.Random r = new System.Random();
    SetBuilder returnSet = new SetBuilder();

    //Retrieve random tuples until the return set is filled.
    int i = set.Tuples.Count;
    foreach (Tuple t in set.Tuples)
    {
        if (r.Next(i) < returnCount)
        {
            returnCount--;
            returnSet.Add(t);
        }
        i--;
        //Stop the loop if we have enough tuples.
        if (returnCount == 0)
            break;
    }
    return returnSet.ToSet();
}

线程安全

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

平台

开发平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

目标平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

请参阅

参考

SetBuilder Members
Microsoft.AnalysisServices.AdomdServer Namespace