Classe SetBuilder
Provides the functionality to create immutable sets.
Espace de noms : Microsoft.AnalysisServices.AdomdServer
Assembly : msmgdsrv (dans msmgdsrv.dll)
Syntaxe
'Déclaration
Public NotInheritable Class SetBuilder _
Implements IDisposable
'Utilisation
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
Exemples
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();
}
Hiérarchie d'héritage
System. . :: . .Object
Microsoft.AnalysisServices.AdomdServer..::..SetBuilder
Sécurité des threads
Tous les membres publics static (Shared dans Visual Basic) de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.