using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Eventanddelegate
{
public delegate void Time(int t);
class Program
{
public static event Time fire;
public static event Time fire1;
public void get()
{
Console.WriteLine("Enter Time");
int t = int.Parse(Console.ReadLine());
if (t <= 5)
{
fire(t);
}
else
{
fire1(t);
// or
// Console.WriteLine("Cannot");
}
}
public void before4(int t)
{
Console.WriteLine("time is " + t+"you can perform action");
}
public void after4(int t)
{
Console.WriteLine("time is " + t+"you cannot perform action");
}
static void Main(string[] args)
{
Program p = new Program();
fire += new Time(p.before4);
fire1 += new Time(p.after4);
p.get();
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Eventanddelegate
{
public delegate void Time(int t);
class Program
{
public static event Time fire;
public static event Time fire1;
public void get()
{
Console.WriteLine("Enter Time");
int t = int.Parse(Console.ReadLine());
if (t <= 5)
{
fire(t);
}
else
{
fire1(t);
// or
// Console.WriteLine("Cannot");
}
}
public void before4(int t)
{
Console.WriteLine("time is " + t+"you can perform action");
}
public void after4(int t)
{
Console.WriteLine("time is " + t+"you cannot perform action");
}
static void Main(string[] args)
{
Program p = new Program();
fire += new Time(p.before4);
fire1 += new Time(p.after4);
p.get();
Console.ReadLine();
}
}
}
// This program is created by Jaspreet Singh
0 comments:
Post a Comment