[longomatch] Add new extension method to swap elements from a list
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add new extension method to swap elements from a list
- Date: Mon, 7 Jul 2014 11:23:15 +0000 (UTC)
commit 6df1ff365d3a051b21ed63fd7ef66d2e3b298d60
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Tue May 27 18:42:01 2014 +0200
Add new extension method to swap elements from a list
LongoMatch.Core/Common/ExtensionMethods.cs | 32 ++++++++++++++++++++++++++++
LongoMatch.Core/LongoMatch.Core.mdp | 1 +
2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.Core/Common/ExtensionMethods.cs b/LongoMatch.Core/Common/ExtensionMethods.cs
new file mode 100644
index 0000000..8b7527e
--- /dev/null
+++ b/LongoMatch.Core/Common/ExtensionMethods.cs
@@ -0,0 +1,32 @@
+//
+// Copyright (C) 2014 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System;
+using System.Collections.Generic;
+
+namespace LongoMatch.Common
+{
+ public static class ExtensionMethods
+ {
+ public static void Swap<T>(this List<T> list, int index1, int index2)
+ {
+ T temp = list[index1];
+ list[index1] = list[index2];
+ list[index2] = temp;
+ }
+ }
+}
diff --git a/LongoMatch.Core/LongoMatch.Core.mdp b/LongoMatch.Core/LongoMatch.Core.mdp
index 28832ce..53375ac 100644
--- a/LongoMatch.Core/LongoMatch.Core.mdp
+++ b/LongoMatch.Core/LongoMatch.Core.mdp
@@ -136,6 +136,7 @@
<File subtype="Code" buildaction="Compile" name="Handlers/Drawing.cs" />
<File subtype="Code" buildaction="Compile" name="Interfaces/Drawing/IDrawable.cs" />
<File subtype="Code" buildaction="Compile" name="Interfaces/Drawing/ICanvasObject.cs" />
+ <File subtype="Code" buildaction="Compile" name="Common/ExtensionMethods.cs" />
</Contents>
<References>
<ProjectReference type="Package" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]