using System;
class InitDemo{
private int intInstanceVar;
private bool boolInstanceVar;
public void Operation(){
int intLocalVar;
bool boolLocalVar;
Console.WriteLine("intInstanceVar: {0}. boolInstanceVar: {1}",
intInstanceVar,
boolInstanceVar);
// Compile time errors:
Console.WriteLine("intLocalVar: {0}. boolLocalVar: {1}",
intLocalVar,
boolLocalVar);
}
public static void Main(){
new InitDemo().Operation();
}
} | |
default initial value: 0
default initial value: false
not initialized
not initialized
Compile time errors:
Use of unassigned local variables
|