This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using UnityEngine; | |
| using System.Collections; | |
| public class AssetBundleSample : MonoBehaviour { | |
| public GUIText guitext; | |
| // Use this for initialization | |
| void Start () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void NumberGuessingGame() | |
| { | |
| Random rand = new Random(); | |
| int generatedNumber = rand.Next(0, 100); | |
| Console.WriteLine("Please enter a number between 0 and 100:"); | |
| string input = Console.ReadLine(); | |
| int numberInput = Convert.ToInt32(input); | |
| if (numberInput == generatedNumber) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace IntroductionToCSharp2 | |
| { | |
| public enum University | |
| { | |
| USM=0, | |
| UITM, | |
| UM, | |
| UKM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| public class Program | |
| { | |
| public static void Main() | |
| { | |
| //Step1 - Create a list of food available | |
| //Todo: Add more items to the menu. | |
| string menu = "Roti, Nasi Kandar, Beef Burger, Cheese Burger"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void ArrayExamples() | |
| { | |
| Random rand = new Random(); | |
| //declare an array and allocate 10 "spaces" for it in memory. | |
| int[] num = new int[10]; | |
| //assign random numbers | |
| for (int i = 0; i < 10; i++) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Lists the examples. | |
| /// </summary> | |
| public static void ListExamples() | |
| { | |
| Random rand = new Random(); | |
| List<int> listOfNumbers = new List<int>(); | |
| listOfNumbers.Add(rand.Next(0,10)); //add a few random numbers to the list | |
| listOfNumbers.Add(rand.Next(0,10)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Dictionaries the examples. | |
| /// </summary> | |
| public static void DictionaryExamples() | |
| { | |
| Dictionary<string, string> nameAndId = new Dictionary<string, string>(); | |
| nameAndId.Add("Dan", "01-1234"); | |
| nameAndId.Add("Stan", "01-1235"); | |
| nameAndId.Add("Adam", "02-1234"); | |
| nameAndId.Add("Sarah", "03-1234"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static void DictionaryProject() | |
| { | |
| Dictionary<string, decimal> menu = new Dictionary<string, decimal>(); | |
| menu.Add("Ayam goreng", 2.50m); | |
| menu.Add("Nasi Putih", 1.50m); | |
| menu.Add("Roti Telur", 2.50m); | |
| menu.Add("Roti Canai", 1.10m); | |
| menu.Add("Coca Cola", 2.20m); | |
| menu.Add("Teh Ais", 2.50m); | |
| //todo: add more items onto the menu list. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace IntroductionToCSharp1 | |
| { | |
| /// <summary> | |
| /// Types of car available in this car shop | |
| /// </summary> | |
| public enum CarType | |
| { | |
| Proton = 1, Perodua, Honda |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| namespace IntroductionToCSharp2 | |
| { | |
| public enum University | |
| { | |
| USM=0, | |
| UITM, | |
| UM, |