Export (0) Print
Expand All
Expand Minimize
9 out of 149 rated this helpful - Rate this topic

Compiler Error CS0103 

Error Message

The name 'identifier' does not exist in the current context

An attempt was made to use a name that does not exist in the class, namespace, or scope. Check the spelling of the name and check your using statements and assembly references to make sure that the name you are trying to use is available. One common mistake is to declare a variable within a loop or a try block and then attempt to access it from an enclosing code block or another code block, as shown in the following example.

The following sample generates CS0103:

// CS0103.cs
using System;

class MyClass
   public static void Main()
      // MyClass conn = null;
         MyClass conn = new MyClass();   // delete this line
         // and uncomment the following line and the line above the try
         // conn = new MyClass();
      catch(Exception e)
         if (conn != null)   // CS0103
            Console.WriteLine("{0}", e);
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.