Decompiler Casting Dot Net Source

Program-Transformation.Org: The Program Transformation Wiki
This program is adapted from the book Decompiling Java, chapter 1.

using System;
public class Casting {
    public static void Main(String[] args){
        for(char c=(char)0; c < (char)128; c++) {
            Console.WriteLine("ascii {0} character {1}", (int)c, c);
The only real trick here is the cast to integer in the call to WriteLine; it would be nice for the decompiler to type the for loop variable (here c) as a char rather than as an integer.

It's surprising how many decompilers fail this simple test.

-- MikeVanEmmerik - 07 Mar 2003