ParallelOptions Class
Represents options that can be specified for PLINQ queries.
Syntax
public class ParallelOptions : IEquatable<ParallelOptions>
Remarks
The ParallelOptions
class allows you to specify various settings for controlling the execution of parallel queries in LINQ.
These options include setting the maximum degree of parallelism, specifying a cancellation token for aborting the query, and more.
By default, PLINQ automatically manages the degree of parallelism to optimize performance. However, you can use ParallelOptions
to override this behavior if necessary.
Constructors
-
ParallelOptions()
public ParallelOptions()
Initializes a new instance of the
ParallelOptions
class with default settings.
Properties
-
CancellationToken
public CancellationToken CancellationToken { get; set; }
Gets or sets a
CancellationToken
that can be used to signal cancellation of the parallel query. -
MaxDegreeOfParallelism
public int MaxDegreeOfParallelism { get; set; }
Gets or sets the maximum number of concurrent operations that will be used to process the query.
Methods
-
Equals(object obj)
public override bool Equals(object obj)
Determines whether the specified object is equal to the current object.
-
Equals(ParallelOptions other)
public bool Equals(ParallelOptions other)
Determines whether the specified
ParallelOptions
object is equal to the current object. -
GetHashCode()
public override int GetHashCode()
Serves as the default hash function.
-
ToString()
public override string ToString()
Returns a string that represents the current object.