Thursday, June 23, 2011

Wasted #

wastig my life time without
1.Money
2.Friends
3.Family
4.Bike
5.Love

Friday, June 10, 2011

Static Keyword in c#

Notes:-
1.Cannot use "this".
2.If any instance is created ,we can't access the static methods,fields,members,..
3.Constants are implicitly static


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

namespace conStatic
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("// For Static ");
            Console.WriteLine(Cal.mul(23, 43).ToString());

            Console.WriteLine("// ordinary method");
            Cal obj = new Cal();
            Console.WriteLine(obj.adder(65, 23).ToString());

            Console.ReadLine();
        }
    }

    public class Cal
    {
        public static int x;
        public static int y;

        public int adder(int x, int y)      //we cannot use "this" operator
        {
            return x + y;
        }

        public static int mul(int x, int y)
        {
            return x * y;
        }
    }
}



// In case any points need to be added Post it in Comments
//Karthik

Wednesday, June 1, 2011

"foreach" statement in c#

"ForEach" Statement helps the loop to run without any declaration for length
It also Reduces the the code by not declaring any variable which can check for Length


Eg:


string [] Emp_names = {"raj","Kumar","Joe","Mark","christie"};


 foreach ( string names in Emp_names)
  {
      console.writeline(names);
  }