So, in class I am almost done with the C# tutorials and I am at the last section. In the section before, there was a tutorial on properties. Properties come up in many of the tutorials, so I wanted to fully understand how and when to use them. Properties are a very important aspect of code and I wanted more clarification on them.
I found a couple articles on properties called Properties (C# Programming Guide), which gave some insight to properties and also had sub articles on specific parts. I learned that properties can be one of three kinds: write-only, read-write, read-only. Read-only have only the get accessor, while read-white has both the get and set accessor. Write-only has only the set accessor. Get and set property accessors have different uses. Set property accessors are used for assigning values, while get property accessors are for returning the property value. Each property has different accessibility levels. Auto-implemented properties are properties that can be implemented without a accessor code. Properties are a way to set and get values while not showing verification code. I learned that when you want to define a value that being assigned using the set accessor, you use the keyword value. I wanted to know more specifically on how to use properties so I clicked on one of the sub articles that was on using properties called Using Properties (C# Programming Guide). I learned that properties are a combination on methods and fields. You can do many things with properties: changing values of fields, validate data, figure out if data is from other sources, and do things when data has been changed. To declare a property, you have to specifying the access, then put the type and the name, then put a code block with either a set or get accessor. There are many access modifiers that property can have. They can be private, public, protected, internal, private protected, or protected internal. Properties can also be declared abstract, static, or virtual. Points about Properties:
“Properties (C# Programming Guide).” Microsoft Docs, docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/properties. “Using Properties (C# Programming Guide).” Microsoft Docs, docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/using-properties.
0 Comments
So, in class we are still doing C# tutorials and I am at the second section. I recently finished a tutorial on variable scopes. I feel that variable scopes will come up later in life when I’m coding, so they are very important. I wanted to know more about them and be able to understand them. I went exploring for articles specifically on variable scopes.
I found an article called C# Variable Scopes, which specifically talked about scopes. I learned that a variable’s scope is what controls the visibility of the rest of the code. Most variable are defined in methods, which means the variable's scope is that method, but that’s only once it’s defined. This means that after the method, the variable is ineffective because the code just goes to the next method. I also learned that there are three kinds of scopes. They are method-level, nested, and class. Method-level scopes’ variables are defined inside a method. The variables are only used in that method and can’t be used anywhere else. Nested scopes’ variables can be used out of their code blocks, unlike method-level, which can be used within nested scopes and methods. Class-level scopes’ variables can be used anywhere in the class. Variable Scopes:
Works Cited C# Variable Scopes, www.blackwasp.co.uk/CSharpVariableScopes.aspx. We have finally stopped the 3d modeling animation unit. I didn’t finish all the assignments because I was very behind. I have a screenshot from one of mine on my selected works page, so that you can see what a finished animation looks like. Now that we’re done with 3d modeling, we are doing something different. We are finally coding!!!!! I love coding even though it can be frustrating. Coding requires patience and precision. I feel that coding is very important for a future game designer or any person interested in a digital field like web design. Our “project” for this unit is following a bunch of tutorials. We aren’t doing C++, but instead C#. Most game designing programs use C# or some other kind of script for its programming. C# is very common, so it is very important to understand and learn the language. So to help better my understanding of C#, I researched more about it.
I browsed the internet for more information and found an article on Microsoft about C# called “A Tour of C#”. The article tells you about many aspects of the language and even has subpages on some of the aspects. According to the article, C# has a unified type system which allows it to support different types. It supports value types and reference types. The types share mutual operators. I clicked on the subpage for types, because I had just finished an assignment on type and don’t fully understand how to use it. Within the value and reference types there are subcategories. Value types are sorted into four categories: simple, enum, struct, and nullable value types. Examples of simple types are float, double, and bool. Reference types also have four subcategories: class, array, interface, and delegate. Examples of class types are strings and arrays. Info about C# and Types:
Works Cited BillWagner. “C# Types and Variables - A Tour of the C# Language.” C# Types and Variables - A Tour of the C# Language | Microsoft Docs, docs.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/types-and-variables. BillWagner. “A Tour of C# - C# Guide.” A Tour of C# - C# Guide | Microsoft Docs, docs.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/index. |
AuthorI'm a student at Durham School of the Arts, and currently in the Game Art Design pathway. I like playing the Sims 4, playing with dogs, and riding horses. This blog will reflect my learning and discoveries. Archives
May 2019
Categories
All
|