Saqib Ullah

BootStrapper Know How

  Home  |   Contact  |   Syndication    |   Login
  109 Posts | 1 Stories | 820 Comments | 15 Trackbacks

News



Article Categories

Archives

Post Categories

Blogging websites

Favourite Blogs

Private Links

Sites

OOPs

Hello geeks after a long gap I come back with a very arousing blog. When ever you see .Net Framework or any Microsoft patterns & practices library configure, they allow the developer to load the external components through some configurations in Web.config or App.Config file and that will be later called by the framework at runtime. Ok let take an example of Microsoft.Practices.Enterpr... Interface that require to format a LogEntry in a way suitable for...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

According to C# specification interface contain a signature of events but a complete and brief implementation of events through interface is not available on the net. First you identify the interface public interface IControl { // Raise this event. event EventHandler OnCommand; } According to my need I create a class that inherit from System.EventArgs public class CommandArgs : EventArgs { public string CommandName; } My OutCommand class is a implementation of IControl interface that contain an OnCommand...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

My following class is a complete C# class because its contain all possible declarations. using System; class MyClass { public const int MyConst = 45; public int MyField = 64; public static int MyStaticField = 65; public void MyMethod() { Console.WriteLine("MyClass.... call"); } public int MyProperty { get { return MyField; } set { MyField = value; } } public event EventHandler MyEvent; public int this[int index] { get { return 0; } set { Console.WriteLine("this[{0}] = {1}", index, value); }...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

This is my C# class and its compatible with all .Net framework versions. public class Person { // Fields private string _name; private int _age; private string _city; private string _company; // Properties public string Name { get { return _name; } set { _name = value; } } public int Age { get { return _age; } set { _age = value; } } public string City { get { return _city; } set { _city = value; } } public string Company { get { return _company; } set { _company = value; } } } From the last bit...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

In this blog I want to describe you three ways how to write singleton class that is thread safe. First Classpublic sealed class TSSingleton{private static volatile TSSingleton instance = null;private static object syncObj = new object();// make the default constructor private,// so that no can directly create it.private TSSingleton(){}// public property that can only get// the single instance of this class.public static TSSingleton Instance{get {// only create a new instance if one doesn't already...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati