Skip to main content

How variables and properties work/compare.

Variables are storage locations that data can be stored in. They are are a way of naming data locations that can be later on used in the program. Variables generally have four attributes: an identifier, data location, type and value.  We have used variables in most of our programs in class, for example, storing names as strings and numbers as doubles/ints.
Properties on the other hand can be looked as a special type of method that exposes a variable. A property can have can have a Get procedure (read only), a Set procedure (write only), or both (read-write). Properties are effective in a way that they have access to private data inside of a class, and can manipulate the data as it enters or leaves the class.
Variables and properties are both important in programming because they help store and manipulate data. Variables can be used to store and protect important user data inside of classes, and the property of those variables help manage what data is only going out into outside classes. I feel like as programs get bigger we will be creating greater amounts of classes that will have to share data, and variables and properties will become important as to what data is going to be shared and protected.

Sources:
https://www.techopedia.com/definition/25647/variable-programming
http://stackoverflow.com/questions/4142867/what-is-difference-between-property-and-variable-in-c-sharp

Comments

Popular posts from this blog

The use of libraries are an important part of coding.

A library in programming code is a collection of similar objects that are stored for occasional use.  It is a collection of reusable and precompiled programming routines that the programmer can "call" when writing code so that the programmer can just use and not have to write it. Frameworks are reusable software environments that provide functionality to facilitate development of software applications, products and solutions. They can include compilers, code libraries, tool sets and application program interfaces to help the development of projects and solutions. A namespace are structured hierarchies that serve to allow the reuse of different names in different contexts, and have a purpose of avoiding name collisions between multiple identifiers that share the same name. A class is like a blueprint, it is basically set of instructions that define how an object looks and its specifications, they can store things and do things. Finally method is a series of statements that ...

MATC Event Planner Project

In my IT Project management class I had to work with team mates to create a project that we could essentially propose in the real world. The project we created was an event planner that MATC organizations could use to create events, since there is no streamlined system in place today. During this process I learned the different methodologies that people can use to create and successfully develop a project. The time I spent in creating and working with my team in this project has taught me the importance of planning a project instead of jumping into it right away.    Here is the link to my final project's proposal document:  Project Proposal Project Presentation

WHILE and IF statements

A while loop statement will repeatedly execute a statement as long as the given condition is true. If the while loop's condition is set to true then the program will go into the loop, and will keep looping as long as that condition remains true. For example: int score = 15; while (score  <  20)       {             Console.WriteLine("value of score: {0}"), score;              score++;        }        Console.ReadLine(); In this example the program will go into the loop for as long as the value of score is less than 20. Once it's in the loop it will increment the value of score by one, then it will check if a is still less than 20. Once the value of score reaches 20, it will no longer go into the loop as the condition will no longer ...