Skip to content

Instantly share code, notes, and snippets.

@ierhalim
Last active January 1, 2021 14:46
Show Gist options
  • Select an option

  • Save ierhalim/20290bf11d668d71a95d86f980ccd766 to your computer and use it in GitHub Desktop.

Select an option

Save ierhalim/20290bf11d668d71a95d86f980ccd766 to your computer and use it in GitHub Desktop.
Y7O3 Paralel programlama
using System;
using System.Collections.Generic;
using System.Linq;
namespace ParallelLinQExample
{
class Program
{
static void Main(string[] args)
{
int[] numbers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var filtered = numbers.AsParallel().AsOrdered().Where((number) =>
{
Console.WriteLine("Current Number:{0}", number);
return number > 5;
});
Console.WriteLine("Before GetEnumarator.");
// ToList metodu GetEnumerator metodunu çalıştırır.
// Bkz: https://github.com/microsoft/referencesource/blob/master/System.Core/System/Linq/ParallelEnumerable.cs (Satır: 4907,4918,4922)
// Bkz: https://referencesource.microsoft.com/#mscorlib/system/collections/generic/list.cs,61f6a8d9f0c40f6e (Satır: 98)
List<int> filteredList = filtered.ToList();
Console.WriteLine("After GetEnumarator.");
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment