mirror of
				https://github.com/esiur/esiur-dotnet.git
				synced 2025-10-30 23:51:34 +00:00 
			
		
		
		
	Static Arrays
This commit is contained in:
		| @@ -39,7 +39,9 @@ namespace Esiur.Core | ||||
|         int count = 0; | ||||
|         bool sealedBag = false; | ||||
|  | ||||
|          | ||||
|  | ||||
|         public Type ArrayType { get; set; } | ||||
|  | ||||
|         public AsyncBag Then(Action<object[]> callback) | ||||
|         { | ||||
|             base.Then(new Action<object>(o => callback((object[])o))); | ||||
| @@ -82,7 +84,17 @@ namespace Esiur.Core | ||||
|                     results[index] = r; | ||||
|                     count++; | ||||
|                     if (count == results.Count) | ||||
|                         Trigger(results.ToArray()); | ||||
|                     { | ||||
|                         if (ArrayType != null) | ||||
|                         { | ||||
|                             var ar = Array.CreateInstance(ArrayType, count); | ||||
|                             for (var i = 0; i < count; i++) | ||||
|                                 ar.SetValue(results[i], i); | ||||
|                             Trigger(ar); | ||||
|                         } | ||||
|                         else | ||||
|                             Trigger(results.ToArray()); | ||||
|                     } | ||||
|                 }); | ||||
|             } | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user