سؤال

I built a concurrent list class that implements the interfaces IEnumerator<T> and IEnumerable<T>.

My goal is to be able to write:

IEnumrable<string> MyConcurrentList1 = new ConcurrentList<string>();

MyConcurrentList1.AsParallel().MyExtantionMethod_ADD("aaaa");

I want to be able to call the method I wrote in the ConcurrentList<T> from the extenstion method of the ParallelQuery!

هل كانت مفيدة؟

المحلول

I think you mean to ask: how to add a extension method for behind the AsParallel().

It's simple: the method returns a ParallelQuery. So use something like this:

public static class ExtensionMethods
{
    public static void MyExtantionMethod_ADD(this ParallelQuery query, string parameter1)
    {
        ...
    }
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top