Variable default name : Variable Definition « Language Basics « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » Language Basics » Variable DefinitionScreenshots 
Variable default name
Variable default name


using System;

class DefValObject
{
  // Here are a number of fields...
  public sbyte  theSignedByte;
  public byte    theByte;
  public short  theShort;
  public ushort  theUShort;
  public int    theInt;
  public uint    theUInt;
  public long    theLong;
  public ulong  theULong;
  public char    theChar;
  public float  theFloat;
  public double  theDouble;
  public bool    theBool;
  public decimal  theDecimal;
  public string  theStr;
  public object  theObj;

    public static int Main(string[] args)
    {
    DefValObject v = new DefValObject();

    // Print out default values.
    Console.WriteLine("bool: {0}", v.theBool);
    Console.WriteLine("byte: {0}", v.theByte);
    Console.WriteLine("char: {0}", v.theChar);
    Console.WriteLine("decimal: {0}", v.theDecimal);
    Console.WriteLine("double: {0}", v.theDouble);
    Console.WriteLine("float: {0}", v.theFloat);
    Console.WriteLine("int: {0}", v.theInt);
    Console.WriteLine("long: {0}", v.theLong);
    Console.WriteLine("object: {0}", v.theObj);
    Console.WriteLine("short: {0}", v.theShort);
    Console.WriteLine("signed byte: {0}", v.theSignedByte);
    Console.WriteLine("string: {0}", v.theStr);
    Console.WriteLine("unsigned int: {0}", v.theUInt);
    Console.WriteLine("unsigned long: {0}", v.theULong);
    Console.WriteLine("unsigned short: {0}", v.theUShort);

        return 0;
    }
}


           
       
Related examples in the same category
1.Declaring a variable.
2.Initializing a variable.
3.Heap and Stack Memory
4.Two reference type variables may refer (or point) to the same objectTwo reference type variables may refer (or point)                to the same object
5.Create a 4-bit type called NybbleCreate a 4-bit type called Nybble
6.Use new with a value typeUse new with a value type
7.Init variableInit variable
8.An attempt to reference an uninitialized variable
9.Illustrates variable scope
10.Demonstrate the use of readonly variablesDemonstrate the use of readonly variables
11.Uninitialized Values
12.Int, float, double, decimalInt, float, double, decimal
13.Demonstrate dynamic initializationDemonstrate dynamic initialization
14.Demonstrate block scopeDemonstrate block scope
15.Demonstrate lifetime of a variableDemonstrate lifetime of a variable
16.This program attempts to declared a variable in an inner scope
17.Demonstrate castingDemonstrate casting
18.A promotion surpriseA promotion surprise
19.Using casts in an expressionUsing casts in an expression
20.Create an implication operator in C#Create an implication operator in C#
21.declaring a reference type variable and creating an object the variable will reference
22.Definite Assignment and ArraysDefinite Assignment and Arrays
23.Variable Scoping and Definite Assignment:Definite AssignmentVariable Scoping and Definite Assignment:Definite Assignment
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.