Sponsored Ad

Tuesday, April 5, 2011

How to Fix C# Error - Identifier too long

This error you will get when you try to declare a variable of length more than 512 chars. The below code will produce a compile time error: Identifier too long

using System;

namespace MyApp
{
    class too_long_class
    {
        public static void Main(string[] args)
        {
            int intsssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss = 0;
            Console.WriteLine();
            Console.Read();
        }      
    }
}

To fix above error just reduce the number of char in variable name less than 512.

No comments:

Post a Comment

Sponsored Ad

Development Updates