This is the fourth and fifth lesson in the C# fundamentals by Scott Allen and touches on members and control flow in c# (c sharp). It is available on PluralSight and you can get a free trial by following the instruction on our home page.
Members in c#
I found it extremely boring, which means that this was one of the most difficult sections of the C# fundamentals course . This unfortunately means that I will have to watch it several times as everything is important. I need to understand c# members.
The lesson or the link in the references can explain this a lot better than I can. Members in c sharp consists of fields, properties, methods, events and delegates.
Control Flow in c#
I have been waiting to watch the control flow lesson as in my opinion its the best part of any programming language. Control flow is much like the rocks and river in the picture above. The rocks determine where the water flows.
Control flow is used extensively when you program your game in Unity3d. As an example, you might need to control if a character can jump over an obstacle or if the obstacle is too high (if statement control). Another control might be when you need to determine how many times a machine gun will shoot before it runs out of bullets (while statement control).
The following are the general categories when you are trying to control the flow. You should be aware that each category can have a few different commands.
- If and else statement that control which code is executed.
- This is similar to if and else statements, its called a case statement. The difference is that the case statement is a more elegant. If you have a lot of option you should use this statement. This stops you from having a lot of if else statements that are nested.
- You use this when you want to execute code repeatedly. The code will execute repeatedly until you stop the code through different options or statements.
- This is for jumping out of an iteration, another block of code and then send the program to another part of the program.
- This is used for error exceptions within your code.
- This is also used for exception within your code. This determines how you handle an exception.
- You use this for several exceptions that are chained together and only one of the chained exceptions will be executed.
The following links will explain the above member concepts in more detail. Members and control flow in c# is important, and I would say that the members section of c# will challenge you as it is not really an exciting part of c# programming. Control flow is awesome when compared to members. In my opinion control from in c3 is the most exciting part of any programming language.
Training for my path to creating a game now consists of 3 hours in total, so just another 177 hours of training left. I am doing quite well for day 4!