2
votes
1answer
29 views

XML to Windows.Forms.Keys List

It took me a lot of poking around and unit testing to get the code to look like it is right now. So I have a XML file which in part looks like this <FunctionKeys> ...
3
votes
1answer
82 views

Calculating n x n determinant

According to instructions and sample code from MSDN Magazine and comments from post here determinant of n x n... I changed code to be like this: using System; internal class ...
2
votes
1answer
109 views

Too slow two strings comparer

I have 2 strings for example: abcabc and bcabca or aaaabb and abaaba I checked that second string is the same or not like first string but shifted. bcabca = ..abca + bc... Here is code it works ...
2
votes
3answers
112 views

Searching item in array

I have a program that calculates some values and saves them to an array. Before save a value, program checks if there is already an identical value in array: string someData = GetData(); bool ...
3
votes
3answers
112 views

Cached empty collections

I often find myself in need to create empty collections. One of those days several years ago, I wrote something like the following to address that: public static class Array<T> { // As a ...
0
votes
1answer
225 views

Best way convert byte array to hex string in C#

I want to find a prettier version of this method: public static string ByteArrayToString(byte[] byteArray) { var hex = new StringBuilder(byteArray.Length * 2); foreach (var b in byteArray) ...
4
votes
1answer
367 views

A blocking buffer manager to provide segments of a byte array

Since asynchronous operations (like Socket's Begin*-End* pairs and *Async methods) that use IOCP under the hood cause the byte array that you use as buffer to be pinned in the memory. So if you ...
3
votes
1answer
129 views

C# Array Mutator Methods to mimic JavaScript Array Mutator Methods

Between .NET's built-in collection libraries and LINQ extension methods, I never have to use arrays. An unfortunate consequence of this is that I am probably less competent in working with this very ...
6
votes
7answers
1k views

Comparing string arrays

My code does what I need it to do, but I think I am missing the "right" way to do this with comparing the arrays. Essentially what I need this to do is compare a textbox entry against two different ...
3
votes
3answers
195 views

Improving the code to turn a string into an array of numbers?

I have a string of numbers, like "31654918562314", and I want to convert it into an array of integers. The code I've written is: string source = "31654918562314"; int[] numbers = new ...
5
votes
4answers
232 views

Adjusting integer based on multiple elements in int array

I'm working with the following code which adjusts an int based on multiple elements of an integer array. I am wondering if there's a cleaner, easier-to-read construct for this: int Blue = 0; int[] ...