Skip to main content

Posts

Showing posts with the label C#

C# 8 is becoming too terse and it's going to backfire

I love working in C#, plain and simple. C# gets the job done, but - in it's latest preview, it's becoming too terse. Let me explain. A 'nifty logo don't you say? Patterns Have you ever heard of them? Well, besides software design patterns  or if you are hungry, cookie patterns , there is something called pattern matching in C# 7 and it is pretty handy. If you've never used pattern matching before, you can check if a variable is of a certain type and assign this variable to a new variable in a single line. The example below explains how this will work. Using the is type pattern expression Perhaps I haven't given it much thought to make use of this yet, but this feature out there and it makes sense. There really isn't any indication that we are assigning a variable in the code, we aren't using an equal sign or semi colon on the line, but still, it is an easy concept to learn. This new feature in C# 7 is not any more complicated than a ...

How to become a better programmer

I'll be the first to admit, programming was never something I found easy. My very first experience in programming was when I got this book at the ripe age of 11. I liked playing my Nintendo 64  and wanted to make games on my own. The book that changed it all for me My ability was far under sub-par. Somewhere in these  forums I wrote a post asking for help trying to understand a while loop - needless to say I got defensive because I felt I was being talked down by people smarter than me, telling me that I should start and learn more simpler things first (than dive right into making a PC game). Forums did actually look like this (circa 2005) The truth was, I was being too ambitious. BUT - TwisterMan was not going to code itself! (All drawn in glorious Microsoft Paint :)). Animation frames of TwisterMan doing some whirlwind attack Watch out for spikeo ! *rawr* And whoever this boss was called... Baaaa? The point I'm trying to get across i...

Creating .GIFs in C#

It's almost the season for Christmas , and what a fun way to tie in the season with some programming than learning how to make .GIF files with C#. We are going to be making a Christmas tree as shown below! Merry Christmas Christmas doesn't last for  just one day , so let's prepare to celebrate it when it comes! What's in a .GIF? The .GIF file format is made up of many different parts , but this picture does the best job at explaining that at a glance. The .GIF file format Each section is a collection of bytes written to a file in a particular format. By following the specification , we can write these bytes to a file and create for us our own .GIF file by hand. No, you don't have to create .GIF files by hand. You can use different libraries  to do the same thing we are about to do. In fact, if you are intending to use any .GIF - related code in production , you should be using a library. Libraries are better tested and have better perf...