Tag: C#
-
Declare and use read write properties in C# Part 3 – Create an instance of the Person class and set values on the object
So finally we’ll create a new instance of the class inside our Main of the TestPerson class. Then we’ll set some values on the object and then increment the property. Time to run the app! Great work Sherlock!
-
Declare and use read write properties in C# Part 2 – Declare the properties
Now it’s time to declare the properties in the Person class. There we go! Now in the last post we’ll create two instances of the Person class and set some values on our two objects.
-
Declare and use read write properties in C#
Declare the backing fields Declare the properties Create an instance of the Person class and set values on the object
-
Declare and use read write properties in C# Part 1 – Declare the backing fields
Let’s continue with our C# programming guide here. This builds on our previous post here on C# classes. First edit the code for the Person class. Remove the constructor that sets the name property and the existing property. Next add the backing fields. Great! Now in the next post we’ll declare the properties.
-
Let’s Create, .NET! Project ATM Part 6 – Add a log feature
For this purpose we’ll use a simple queue but there are many other options in creating a log feature. First create the Queue. Now update the Balance property to log when the value is set. Finally we’ll create a method to return the log when called. Let’s jump back into the program and add a […]
-
Let’s Create, .NET! Project ATM Part 5 – Write the ATM methods
Now what we need to do here is create our methods that interacts with the user to change the balance property inside our ATM class. We already created our add method so let’s add a method to withdraw from our balance. Wait a minute, what about if we don’t have any in our balance account? […]
-
Let’s Create, .NET! Project ATM Part 4 – Write a loop for user input
Time to add our loop to maintain the console app running for input. We also add a switch statement with a dummy case so we can accept different entries that will be our method calls. Perfect! Now next time we’ll create our methods for our ATM.
-
Let’s Create, .NET! Project ATM Part 3 – Write a test for our method.
So let’s test our method by writing a test. Since we create the instance of the ATM at runtime we would expect the balance to be whatever we pass as parameters. Now if we build this it should fail since we are telling our AreEqual that we are expecting a 3 to be returned. Now […]
-
Let’s Create, .NET! Project ATM Part 2 – Create our ATM class
Let’s check that our test works. Create a new class in the main project that will be an ATM object that will have a property for our balance. Now let’s create a method that adds to our balance and returns our updated balance. Perfect! Now in the next post we’ll test this method.
-
Let’s Create, .NET! Project ATM
Create the project Create our ATM class Write a test for our method Write a loop for user input Write the ATM methods Add a log feature