Esempio n. 1
0
        public Task <IEnumerable <int> > GetFibonacciAsync(int n)
        {
            TaskCompletionSource <IEnumerable <int> > tcs = new TaskCompletionSource <IEnumerable <int> >();

            Task.Run(() =>
            {
                SampleFuncsWrapper.GetFibonacci(handle, n, (numberPtr, size) =>
                {
                    int[] numbersArray = new int[size];
                    Marshal.Copy(numberPtr, numbersArray, 0, size);

                    tcs.SetResult(new List <int>(numbersArray));
                });
            });

            return(tcs.Task);
        }
 public Task <IEnumerable <int> > GetFibonacciAsync(int n) => SampleFuncsWrapper.GetFibonacciAsync(handle, n);
Esempio n. 3
0
 public SampleFuncs()
 {
     handle = SampleFuncsWrapper.CreateSampleFuncs();
 }
Esempio n. 4
0
 protected override bool ReleaseHandle()
 {
     SampleFuncsWrapper.ReleaseSampleFuncs(this);
     return(true);
 }