public static QuerySettings SpecifiedQuerySettings(this ParallelQuery source) { source.NotNull(nameof(source)); object querySettings = QuerySettingsProperty.GetValue(source); return(new QuerySettings() { TaskScheduler = TaskSchedulerProperty.GetValue(querySettings) as TaskScheduler, DegreeOfParallelism = DegreeOfParallelismProperty.GetValue(querySettings) as int?, ExecutionMode = ExecutionModeProperty.GetValue(querySettings) as ParallelExecutionMode?, MergeOptions = MergeOptionsProperty.GetValue(querySettings) as ParallelMergeOptions? }); }