facebook google twitter tumblr instagram linkedin
  • Home
  • Travel
  • Life Style
    • Category
    • Category
    • Category
  • About
  • Contact
  • Download

c-sharp codes

This is completely for C# .Net programming blog. It covers all or Microsoft Visual Studio .Net 1.1, 2.0. 3.0 and 3.5.

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

namespace Get_Set_Test
{
class Program
{

static void Main(string[] args)
{
//CREATE OBJECT
GetSet_Test obj = new GetSet_Test();

//SET VALUE OF THAT CLASS
obj.Val = 5;
//GET VALUE OF THAT CLASS
Console.WriteLine(obj.Val);
Console.ReadLine();



}
public void TypeTest(Control
obj)
{

}
}

class GetSet_Test
{
int val;
///
/// Set or Get value of variable
///

public int Val
{
//SET VALUE TO VARIABLE
set
{
val = value; ;
}
//GET VALUE OF THAT VARIABLE
get
{
return val;
}
}
}
}
12:55 AM 1 comments
Very simple user event in C#. Codes are:

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

namespace Events
{
class Program
{
static void Main(string[] args)
{
EventTestClass obj = new EventTestClass();
obj.RaiseEvent1 += new EventTestClass.TestEventDelegate(obj_RaiseEvent);
obj.Run("call 1", "arg");
obj.Run("call 2", "arg");
obj.Run("call 3", "arg");
Console.ReadLine();

}

static void obj_RaiseEvent(object sender, object Args)
{
Console.WriteLine("Done. "+sender.ToString()+"...............\n");
}

}
class EventTestClass
{
public delegate void TestEventDelegate(object sender, object Args);
public event TestEventDelegate RaiseEvent1;
public EventTestClass()
{

}

public void Run(object sender, object Args)
{
Console.WriteLine("Run called");
RaiseEvent1(sender, Args);
}

}

}
7:16 AM No comments

About me

About Me


Aenean sollicitudin, lorem quis bibendum auctor, nisi elit consequat ipsum, nec sagittis sem nibh id elit. Duis sed odio sit amet nibh vulputate.

Follow Us

Labels

C# User Even

recent posts

Blog Archive

  • ▼  2007 (2)
    • ▼  October (2)
      • Get-Set property in C#
      • User Event in C#

About Me

My photo
Suman Biswas
Software professional, long drive travel is my passion.
View my complete profile
FOLLOW ME @INSTAGRAM

Created with by ThemeXpose