This part of the blog will not be development of the game, rather a step back from everything in order to work on a project that needs to be done in a period of time. However, with that, I personally decided to step down on developing game codes for a bit to understand the foundations of C# and how it works. This will most likely be what the blogs will entail within the next blogs over so that I can take notes and references and help me understand C# a little more and hopefully, it will shed some light into basics on your end as well, personally speaking.
The basics of C# Code is basically to invoke a function, namely a writeline function. In order to invoke this, one must create a launch console application that can be used from Visual Studios. Its a stretch but it helps a lot in development when one wants to test out code.
If you want to write the basic code of writing something to the console application without directly editing in them, appearing on the screen. The best way is to use Console.WriteLine(“String”);
Type this below the void class on the Main as follows:
And then, in order to make it not buggy and readable in the console application, one must utilize ReadLine.
This helps to run the application on the string based on the writeline function. By typing the string World X on writeline and program it to run using ReadLine, one can visualize the World X on the console.
Namely, because I typed writeline as follows:
Console.WriteLine(“Welcome to the world of X-100.”);
The result on the picture is as follows:
When using Console.ReadLine, it prints as follows. This can be done with any string as long as it applies in the WriteLine.
These are the basics, but WriteLines aren’t restricted to strings, they also apply to bools and objects depending on the context of the situation. This is useful for transmitting the code on a different format or try to portray the game within the code’s scope of things as much as possible.
This will immediately make the string appear as a text when you load the application. This applies to numbers as well, though it depends on the type of you are setting.
To conclude, using Console.WriteLine and Console.ReadLine is the fundamental basics of C# and a must know to anyone who wants to learn C#. Although, practically, it has little use in the field, it is important to know the fundamental basics of the functions before moving on to the more complex stuff. Because using C# is not simple at all due to the complexity of the language. If you are accustomed to the format, then maybe it would be best. However, it does not necessarily mean that you would understand it the same way programmers do. The crucial thing is that the basics of C# helps in foundation of other programming language. It take time for someone to get used to the code though, depending on how you work your way, since code is essay but with more technicality. Its yours and differs depending on the context, but the essence of code needs to be there to be…. code.. I suppose.
Channel 9,. ‘C# Fundamentals For Absolute Beginners (Channel 9)’. N.p., 2014. Web. 1 July 2015.