[longomatch] Update Swap method to make it easier to use
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Update Swap method to make it easier to use
- Date: Mon, 7 Jul 2014 11:25:06 +0000 (UTC)
commit 1be713b860b785772403eb35f23bc80aefc15e84
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Thu May 29 12:03:36 2014 +0200
Update Swap method to make it easier to use
LongoMatch.Core/Common/ExtensionMethods.cs | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.Core/Common/ExtensionMethods.cs b/LongoMatch.Core/Common/ExtensionMethods.cs
index 8b7527e..f1f9fc4 100644
--- a/LongoMatch.Core/Common/ExtensionMethods.cs
+++ b/LongoMatch.Core/Common/ExtensionMethods.cs
@@ -22,8 +22,12 @@ namespace LongoMatch.Common
{
public static class ExtensionMethods
{
- public static void Swap<T>(this List<T> list, int index1, int index2)
+ public static void Swap<T>(this List<T> list, T e1, T e2)
{
+ int index1, index2;
+
+ index1 = list.IndexOf (e1);
+ index2 = list.IndexOf (e2);
T temp = list[index1];
list[index1] = list[index2];
list[index2] = temp;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]