EvaluateScript and IsCanonicalPubKey implementation, IsCanonicalSignature/CheckSig...
[NovacoinLibrary.git] / Novacoin / IListExtensions.cs
1 \feffusing System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6
7 using System.Diagnostics.Contracts;
8
9 namespace Novacoin
10 {
11     static class IListExtensions
12     {
13         public static void Swap<T>(
14             this IList<T> list,
15             int firstIndex,
16             int secondIndex
17         )
18         {
19             Contract.Requires(list != null);
20             Contract.Requires(firstIndex >= 0 && firstIndex < list.Count);
21             Contract.Requires(secondIndex >= 0 && secondIndex < list.Count);
22             if (firstIndex == secondIndex)
23             {
24                 return;
25             }
26             T temp = list[firstIndex];
27             list[firstIndex] = list[secondIndex];
28             list[secondIndex] = temp;
29         }
30     }
31 }