Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

test

using System.IO;
using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, World!");
    }
}

C# OOP Events Lambda

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

namespace Events_Lambda
{
    // Object Orianted Programmeng
    // Lambda

    // delegate
    public delegate void myDelegate();

    // class
    class Absence // الغياب
    {
        // Event
        public event myDelegate AbsenceEvent;

        public int Absented_Hours;


        // Propertys
        public int Absented_Hours_Property
        {
            get { return Absented_Hours; }
            set { Absented_Hours = value; }
        }

        public Absence(int Hours)
        {
            this.Absented_Hours = Hours;
        }

        public void Verify_Absence(int Max_hours)
        {
            if (Absented_Hours > Max_hours)
            {
                AbsenceEvent();
            }
        }

        /* test one
        public void AlertEvent()
        {
            Console.WriteLine("Warning !");
        }*/


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

            // Lambda
            // example one
            Absence myAbsence = new Absence(10);

            myAbsence.AbsenceEvent += () => Console.WriteLine("Warning !");

            myAbsence.Verify_Absence(8);


            // Lambda
            // example tow
            List<string> Colors = new List<string> { "Red", "Blue", "Orange", "black" };

            Colors.ForEach(Item =>
                {
                    Console.Write("\n\tColors are: - " + Item);
                });

        }
    }
}

1234

using System;

namespace VietJackCsharp
{
    class TestCsharp
    {
        public static void Main()
        {

            int[] arr1 = new int[10];
            int n, i, j, tmp; // tmp duoc su dung lam bien tam (bien trung gian)


            Console.Write("\nSap xep mang theo thu tu tang dan trong C#:\n");
            Console.Write("--------------------------------------------\n");

            Console.Write("Nhap kich co mang: ");
            n = Convert.ToInt32(Console.ReadLine());

            Console.Write("Nhap {0} phan tu vao trong mang:\n", n);
            for (i = 0; i < n; i++)
            {
                Console.Write("Phan tu - {0}: ", i);
                arr1[i] = Convert.ToInt32(Console.ReadLine());
            }

            for (i = 0; i < n; i++)
            {
                for (j = i + 1; j < n; j++)
                {
                    if (arr1[j] < arr1[i])
                    {
                        //cach trao doi gia tri
                        tmp = arr1[i];
                        arr1[i] = arr1[j];
                        arr1[j] = tmp;
                    }
                }
            }
            Console.Write("\nIn cac phan tu mang theo thu tu tang dan:\n");
            for (i = 0; i < n; i++)
            {
                Console.Write("{0}  ", arr1[i]);
            }
            Console.Write("\n\n");      

            Console.ReadKey();
        } 
    }
}

saritha

using system
class hi
{
    static void main()
    {
         Console.WriteLine("hi");
}
    }
   

C# OOP Evens Anonymous

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

namespace Anonymous
{
    // Object Orianted Programmeng
    // Anonymous

    // delegate
    public delegate void myDelegate();

    // class
    class Absence // الغياب
    {
        // Event
        public event myDelegate AbsenceEvent;

        public int Absented_Hours;


        // Propertys
        public int Absented_Hours_Property
        {
            get { return Absented_Hours; }
            set { Absented_Hours = value; }
        }

        public Absence(int Hours)
        {
            this.Absented_Hours = Hours;
        }

        public void Verify_Absence(int Max_hours)
        {
            if (Absented_Hours > Max_hours)
            {
                AbsenceEvent();
            }
        }

        /* test one
        public void AlertEvent()
        {
            Console.WriteLine("Warning !");
        }*/


    }
    class Program
    {
        static void Main(string[] args)
        {
            Absence myAbsence = new Absence(10);

            /* test one
            // event activ
            myAbsence.AbsenceEvent += new myDelegate(myAbsence.AlertEvent);
            */

            // test tow
            // Anonymous
            myAbsence.AbsenceEvent += delegate()
            {
                Console.WriteLine("Warning !");
            };
            // END

            myAbsence.Verify_Absence(8);
            Console.Read();
        }
    }
}

Array 2D

using System.IO;
using System;

class Program
{
    static void Main()
    {
            string[] province = new string[5]{"Kandal","Takeo","Kampot","KampongCham","Battambang"};
            string[] crop = new string[4] {"Bean","Corn","Rice","Potato"};
            //int a = province.Length;
            double[,] paids = new double[5,4]{{200,300,400,100},
                                              {300,500,400,800},
                                              {400,200,400,200},
                                              {900,300,500,300},
                                              {500,400,200,400},
                                            };
            double total=0;
            foreach(int ele in paids){total+=ele;}
            Console.WriteLine(total);
            Console.ReadKey();
    }
}

qwer

using System.IO;
using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, World!");
    }
}

empy

using System.IO;
using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, World!");
    }
}

hithere

using System.IO;
using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, World!");
    }
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.