Freigeben über


SetBuilder-Klasse

Provides the functionality to create immutable sets.

Vererbungshierarchie

System.Object
  Microsoft.AnalysisServices.AdomdServer.SetBuilder

Namespace:  Microsoft.AnalysisServices.AdomdServer
Assembly:  msmgdsrv (in msmgdsrv.dll)

Syntax

'Declaration
Public NotInheritable Class SetBuilder _
    Implements IDisposable
'Usage
Dim instance As SetBuilder
public sealed class SetBuilder : IDisposable
public ref class SetBuilder sealed : IDisposable
[<SealedAttribute>]
type SetBuilder =  
    class 
        interface IDisposable 
    end
public final class SetBuilder implements IDisposable

Der SetBuilder-Typ macht folgende Elemente verfügbar.

Konstruktoren

  Name Beschreibung
Öffentliche Methode SetBuilder() Initializes a new instance of the SetBuilder class.
Öffentliche Methode SetBuilder(Tuple) Initializes a new instance of the SetBuilder class, with a given Tuple.

Zum Anfang

Eigenschaften

  Name Beschreibung
Öffentliche Eigenschaft Count Gets the number of Tuple objects in the set.
Öffentliche Eigenschaft Item Gets the specified Tuple object.

Zum Anfang

Methoden

  Name Beschreibung
Öffentliche Methode {dtor} Releases all resources used by the SetBuilder.
Öffentliche Methode Add Adds a Tuple to the set.
Öffentliche Methode Dispose Releases all resources used by the SetBuilder.
Öffentliche Methode Equals (Geerbt von Object.)
Öffentliche Methode GetHashCode (Geerbt von Object.)
Öffentliche Methode GetType (Geerbt von Object.)
Öffentliche Methode ToSet Gets a Set based on the specified Tuple objects.
Öffentliche Methode ToString (Geerbt von Object.)

Zum Anfang

Beispiele

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();
}

Threadsicherheit

Alle öffentlichen static (Shared in Visual Basic)-Elemente dieses Typs sind Threadsicher. Für Instanzelemente wird die Threadsicherheit nicht gewährleistet.

Siehe auch

Verweis

Microsoft.AnalysisServices.AdomdServer-Namespace