Mega Code Archive

 
Categories / C# / Collections Data Structure
 

Swap two elements in a array

//http://tinyerp.codeplex.com/ //GNU Library General Public License (LGPL) //----------------------------------------------------------------------- // <copyright file="SysUtil.cs" company="Pyramid Consulting"> //     Copyright (c) Pyramid Consulting. All rights reserved. // </copyright> //----------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; namespace Bamboo.Core.Common {     public class SysUtil     {         /// <summary>         /// swap two elements in a array         /// </summary>         /// <param name="objArray">dest array</param>         /// <param name="i">first element</param>         /// <param name="j">the other element</param>         public static void SwapArrayElement(Object[] objArray, int i, int j)         {             Object t = objArray[i];             objArray[i] = objArray[j];             objArray[j] = t;         }     } }