¡@

Home 

c# Programming Glossary: currentindex

What is the most elegant way to get a set of items by index from a collection?

http://stackoverflow.com/questions/1018407/what-is-the-most-elegant-way-to-get-a-set-of-items-by-index-from-a-collection

this IEnumerable T collection IEnumerable int indices int currentIndex 1 using var collectionEnum collection.GetEnumerator foreach.. int index in indices while collectionEnum.MoveNext currentIndex 1 if currentIndex index yield return collectionEnum.Current.. while collectionEnum.MoveNext currentIndex 1 if currentIndex index yield return collectionEnum.Current break Advantages..

Bubble sort using recursion in C#

http://stackoverflow.com/questions/1644440/bubble-sort-using-recursion-in-c-sharp

public static T BubbleSort T input int passStartIndex int currentIndex where T IComparable T if passStartIndex input.Length 1 return.. T if passStartIndex input.Length 1 return input if currentIndex input.Length 1 return BubbleSort input passStartIndex 1 passStartIndex.. and current index 1 and swap if required int nextIndex currentIndex 1 if input currentIndex .CompareTo input nextIndex 0 T temp..

Random playlist algorithm

http://stackoverflow.com/questions/1816534/random-playlist-algorithm

size int array new int size Random rand new Random for int currentIndex array.Length 1 currentIndex 0 currentIndex int nextIndex rand.Next.. Random rand new Random for int currentIndex array.Length 1 currentIndex 0 currentIndex int nextIndex rand.Next currentIndex 1 Swap array.. Random for int currentIndex array.Length 1 currentIndex 0 currentIndex int nextIndex rand.Next currentIndex 1 Swap array currentIndex..