18 February 2014

SIZEOF( ) in c#.net



The sizeof( ) operator tells you the number of bytes allocated for data items.


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

namespace sezeof
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(sizeof(int));
            Console.WriteLine(sizeof(short));
            Console.WriteLine(sizeof(float));
            Console.WriteLine(sizeof(long));
            Console.WriteLine(sizeof(double));
            Console.WriteLine(sizeof(decimal));
            Console.WriteLine(sizeof(char));
            Console.ReadLine();
        }
    }
}


No comments:

Post a Comment