2
votes
1answer
28 views

Search algorithm for specific values in a 3D array/matrix being super slow

I'm trying to create a code that reads a text file (containing (double) numbers between 0 and 1) and filling up a 3D array/matrix (calling it matrix from now on) ...
1
vote
1answer
36 views

Duplication Elimination Project [on hold]

I am currently doing a project for school, and I am completely stumped. We are only on Chapter 8 of C# Development 1 and I have a question about the code. The project is: Use a one-dimensional ...
7
votes
3answers
107 views

Compare string with wildcard string

I have the following function to compare a string with a wildcard string (containing ? and *), as C# doesn't seem to have a builtin function to do it. ...
5
votes
3answers
267 views

How to increase performance/speed of code that uses .Count() on Lists?

The Test PublicQuestion_ComplexTest is taking around 1600ms (1.6 seconds) to run, but used to take 92ms. I have a feeling this is because of recent code changes ...
7
votes
2answers
1k views

A blocking buffer manager to provide segments of a byte array

Since asynchronous operations (like Socket's Begin*-End* pairs and ...
1
vote
1answer
46 views

Find part of string in array, replace entire row with that part of string if found

Following is the string: (I'm getting that from config file so its not constant): ...
6
votes
2answers
377 views

Is there a way to optimise my Perlin noise?

I just started using Perlin noise a few days ago, and the results look quite good. But it takes over 3 seconds to calculate and draw a 1024x1024 bitmap of said noise. I use an array of 1024x1024 to ...
3
votes
2answers
313 views

Check winner in a Tic Tac Toe game

I have the below code to check for a winner in a Tic Tac Toe game. I'm wondering if this is a good approach, and if there is a better way of doing this (maybe by monitoring the state of the board). ...
2
votes
3answers
109 views
4
votes
1answer
54 views

Declaring a large number of 2D arrays to be used as 2D graphic sprites

I'm creating a Space Invaders game, and graphics sprites in it are defined as 2D arrays of colors. It seems like it's going to be cumbersome declaring these arrays the way I currently am: ...
4
votes
2answers
72 views

Addition plus division taking up all my CPU - Kinect depth denoising

I have a method in my class that eats up something like 80% of my processor time while its running. In-fact one line within the method is responsible for the majority of this. The idea behind this ...
6
votes
4answers
403 views

Sum of subset of 5 numbers equals 0

I have a task to print all zero subsets of 5 numbers, input from the console. I have succeeded in implementing a working code, but it seems it is quite complex (it is like inception) and if the count ...
3
votes
2answers
154 views

How to get the Split value from collection?

I have the following key value pair in an array, and am trying to extract and load them into a collection. The below code is working but it can be optimized using Linq: ...
1
vote
1answer
63 views

Problem comparing list to an array [closed]

I am attempting to compare an array to a list. The list contains 4 items that should be repeated in the array and in the same order. Previously all I had to do is make sure that each of the array ...
10
votes
2answers
179 views

Best way to handle elements of a private array

This feels like a simple question, but I'm wondering what the best way would be to manage the elements of a private, fixed-size array. Context: I'm making a simple particle engine, and my ...
6
votes
2answers
289 views

Simplification of byte array comparison algorithm

I have an algorithm that evaluates in input byte[] with a source byte[]. Several conditions can be encountered: Match found No ...
0
votes
1answer
288 views

Copying Dictionary collection into an array [closed]

Hi I want to minimize the following code: ...
1
vote
1answer
7k views

Best way convert byte array to hex string

Is it possible to write this method in a prettier way? ...
2
votes
2answers
114 views

Finding correct format? Arrays and Modulation

I am fairly new to programming and I am having difficulty modulating the following code. The program reads a file, selects certain requirements, and displays them. I have tried to use passing arrays ...
4
votes
1answer
416 views

Improving performance when sorting array of structs by multiple fields

I have an array of a struct containing 5 byte values. I need to sort this array by each value in a different order depending on the situation. These arrays are sometimes quite small (10-30 elements), ...
2
votes
1answer
216 views

array with reusable elements

I need array to store elements, but I don't want to make memory allocations at runtime. So I reuse elements. Some fields are never changes so as I reuse elements I need to assign those fields just ...
1
vote
3answers
198 views

Putting array name in variable and shortening code

I'm a beginner in C# and am doing a simple programming exercise. I would like to put the Item.price and Item.Name into ...
9
votes
5answers
1k views

Repetitive code driving me crazy!

Ok, So first I must say that everything I know about coding I have learned on my own in my spare time so bear with me if my code is primitive, but please, I am open to any comments to make me ...
2
votes
1answer
287 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 ...
3
votes
1answer
1k 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: ...
2
votes
1answer
128 views

Too slow two strings comparer

I have 2 strings for example: abcabc and bcabca or aaaabb and ...
3
votes
3answers
418 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: ...
4
votes
3answers
253 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: ...
6
votes
5answers
4k 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
1answer
236 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 ...
3
votes
3answers
247 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: ...
5
votes
4answers
248 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: ...