George Mamaladze

.NET C# tips, tricks, tweaks. Effective use of data structures and algorithms. Clean code.
posts - 11 , comments - 24 , trackbacks - 0

February 2010 Entries

Back to the roots: .NET binary search and the meaning of the negative number of the Array.BinarySearch() return value
Back to the roots: .NET binary search and the meaning of the negative number of the Array.BinarySearch() return value Recently I gave a group of developers a task witch can be simplified to following simple problem: you have a sorted array of elements; find the index of a given element in this array. They came up with following solution: //given array int[] sortedArray = new[] { 1, 5, 8, 12, 18, 20 }; //Create a list from the array List<int> list = new List<int>(sortedArray); //use IndexOf ......

Posted On Tuesday, February 2, 2010 12:57 AM | Comments (0) | Filed Under [ .NET Framework ]

C# Tweaks - Why to use the sealed keyword on classes
C# Tweaks - Why to use the sealed keyword on classes The sealed keyword is one of the very seldom used modifiers in C#. Probably most of you know what it is for, but only several developers ever used it. See C# Programmers Guide if you are not sure you remember what the keyword is good for: http://msdn.microsoft.com/e... Why shell I use it? Most popular, but not really most important motivation is the performance - JIT compiler can produce more efficient code by calling ......

Posted On Monday, February 1, 2010 5:26 AM | Comments (9) | Filed Under [ .NET Framework ]

Powered by: