Skip to content

Instantly share code, notes, and snippets.

View bridgetechDaniel's full-sized avatar

bridgetechDaniel

View GitHub Profile
@bridgetechDaniel
bridgetechDaniel / IntroductionToCSharpSession2.cs
Created January 5, 2018 09:21
All the example and project code from Introduction to C Sharp Session 2
using System;
using System.Collections.Generic;
namespace IntroductionToCSharp2
{
public enum University
{
USM=0,
UITM,
UM,
@bridgetechDaniel
bridgetechDaniel / IntroductionToCSharpSession1.cs
Last active January 11, 2018 08:26
All the example and project code for session one of Introduction To CSharp
using System;
namespace IntroductionToCSharp1
{
/// <summary>
/// Types of car available in this car shop
/// </summary>
public enum CarType
{
Proton = 1, Perodua, Honda
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.
@bridgetechDaniel
bridgetechDaniel / DictionaryExample.cs
Created January 4, 2018 06:36
Example of how to use a dictionary
/// <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");
@bridgetechDaniel
bridgetechDaniel / ListExample.cs
Created January 4, 2018 06:35
Example of how to use list in c#
/// <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));
@bridgetechDaniel
bridgetechDaniel / ArrayExamples.cs
Created January 4, 2018 06:26
Example of how to use arrays in C#
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++)
{
@bridgetechDaniel
bridgetechDaniel / StringManipulationProject.cs
Last active January 4, 2018 06:24
Example of string manipulation and i/o
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";
@bridgetechDaniel
bridgetechDaniel / StringManipulationExample.cs
Created January 4, 2018 03:20
String manipulation example for Intro to c# class
using System;
namespace IntroductionToCSharp2
{
public enum University
{
USM=0,
UITM,
UM,
UKM
@bridgetechDaniel
bridgetechDaniel / NumberGuessingGame.cs
Created December 28, 2017 09:53
Code Snippets from Introduction to C Sharp class
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)
@bridgetechDaniel
bridgetechDaniel / AssetBundleSample.cs
Created July 4, 2017 14:59 — forked from yaeda/AssetBundleSample.cs
Unity AssetBundle Examples.
using System;
using UnityEngine;
using System.Collections;
public class AssetBundleSample : MonoBehaviour {
public GUIText guitext;
// Use this for initialization
void Start () {