Classe SetBuilder
Provides the functionality to create immutable sets.
Hierarquia de herança
System. . :: . .Object
Microsoft.AnalysisServices.AdomdServer..::..SetBuilder
Namespace: Microsoft.AnalysisServices.AdomdServer
Assembly: msmgdsrv (em msmgdsrv.dll)
Sintaxe
'Declaração
Public NotInheritable Class SetBuilder _
Implements IDisposable
'Uso
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
O tipo SetBuilder expõe os membros a seguir.
Construtores
Nome | Descrição | |
---|---|---|
SetBuilder() () () () | Initializes a new instance of the SetBuilder class. | |
SetBuilder(Tuple) | Initializes a new instance of the SetBuilder class, with a given Tuple. |
Início
Propriedades
Nome | Descrição | |
---|---|---|
Count | Gets the number of Tuple objects in the set. | |
Item | Gets the specified Tuple object. |
Início
Métodos
Nome | Descrição | |
---|---|---|
{dtor} | Releases all resources used by the SetBuilder. | |
Add | Adds a Tuple to the set. | |
Dispose | Releases all resources used by the SetBuilder. | |
Equals | (Herdado de Object.) | |
Finalize | (Herdado de Object.) | |
GetHashCode | (Herdado de Object.) | |
GetType | (Herdado de Object.) | |
MemberwiseClone | (Herdado de Object.) | |
ToSet | Gets a Set based on the specified Tuple objects. | |
ToString | (Herdado de Object.) |
Início
Exemplos
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();
}
Segurança de thread
Qualquer membro público static (Shared no Visual Basic) desse tipo é seguro para threads. Não há garantia de que qualquer membro de instância seja seguro para threads.