Array Basics Example

Oh arrays arrays. How some of us love to hate these. The question always comes up, heck even I ask it. Why use arrays now when there are so many other collection classes in the .NET framework. Especially when the other options are easier to work with and more functionality? You will see me from time to time reverting back to arrays because they teach me the basics of how the other collection options function under the hood. I mean look under the hood at the List collection class. If you look at the methods in that class and how they work. It’s basically doing array work behind the scenes.

One of the most confusing areas of programming, well it was for me when I started. Was the difference between value, reference types, stack, and heap allocation. Arrays helped me understand how reference types work. Meaning that when you make a change to an array anything else that references said array will change also.

So over the next batch of posts you will see various usages of arrays. The programs will be simple. I will still make the source code available if you want.

Continue reading

Parallel Computing Example

I’ve always wondered how parallel computing works. One of my fascinations with computers has been the ability to seem like it’s doing more than one thing at once. Granted the computer is doing one thing after another really really quick. So it would be safe to say that parallel computing is doing more than one thing one item at a time. With multi-processor and multi- core computers being so prevalent in today’s world this concept is really fascinating to me.

What this program does is run two programs that do the same basic thing. Find all the prime numbers of a random range of numbers a specified number of times. I chose a prime number calculation because I wanted to put some kind of load on the CPU for X amount of times.

Continue reading