Learning C# - Online - Free

22/10/2015 19:50

There are some places that you can go to learn C# through the website:

 

Learn CS:
https://www.learncs.org/

Microsoft:
https://www.microsoftvirtualacademy.com/en-us/training-courses/c-fundamentals-for-absolute-beginners-8295

 


Learn C# - Character Escape
https://blogs.msdn.com/b/csharpfaq/archive/2004/03/12/what-character-escape-sequences-are-available.aspx?PageIndex=2


 

These are some statement samples that I learned:


========================================================================================
Learn C# - TXT Reader
========================================================================================
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {


         StreamReader myReader = new StreamReader("Values.txt");

         string line = "";

         while (line != null)
         {

                line = myReader.ReadLine();
                if (line != null)
                        Console.WriteLine(line);
        }

         myReader.Close();
         Console.ReadLine();


        }

**********************
Values.txt
**********************
4
8
15
16
23
42
    }
}




========================================================================================
Learn C# - For Sample (Best Performance)
========================================================================================

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            //string myString = string.Format("{0}!", "Leandro");

            StringBuilder myStringFor = new StringBuilder();
            for (int i = 0; i < 100; i++)
            {
                myStringFor.Append("--");
                myStringFor.Append(i);
                
            }

            Console.WriteLine(myStringFor.ToString());
            Console.ReadLine();

        }
    }
}

021990904 Jane



========================================================================================
Learn C# - Bulding Class
========================================================================================

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            Car myNewCar = new Car();

            myNewCar.Make = "BMW";
            myNewCar.Model = "Z4";
            myNewCar.Year = 2015;
            myNewCar.Color = "Black";





            Console.WriteLine("{0} - {1} - {2}",
                    myNewCar.Make,
                    myNewCar.Model,
                    myNewCar.Color);

            Console.WriteLine("Car's value: {0:C}", myNewCar.determineMarketValue());

            Console.ReadLine();

        }

        private static double determineMarketValue(Car car)
        {
            double carValue = 100.0;

            return carValue;
        }

        class Car
        {
            public string Make { get; set; }
            public string Model { get; set; }
            public int Year { get; set; }
            public string Color { get; set; }

            public double determineMarketValue()
            {
                double carValue = 100.00;

                if (this.Year < 1990)
                    carValue = 1000.0;
                else
                    carValue = 2000.0;

                return carValue;

            }

        }


    }
}