Difference between revisions of "Csharp warning CS0168: The variable 'NeverUsed' is declared but never used"

esse quam videri
Jump to: navigation, search
m (Text replacement - "</csharp>" to "</syntaxhighlight>")
m (Text replacement - "syntaxhighlight lang="csharp" line="1" " to "syntaxhighlight lang="csharp"")
 
Line 1: Line 1:
 
[[Category:Object Oriented Programming]]
 
[[Category:Object Oriented Programming]]
<syntaxhighlight lang="csharp" line="1" >using System;
+
<syntaxhighlight lang="csharp">using System;
 
namespace HelloClass
 
namespace HelloClass
 
{
 
{

Latest revision as of 03:23, 9 February 2016

using System;
namespace HelloClass
{
    class HelloWorld
    {
        public static void Main()
        {
                
            int NeverUsed;
            Console.WriteLine("Hello World!");
        }
    }
}

Produces

Microsoft (R) Visual C# .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.

helloError3.cs(9,17): warning CS0168: The variable 'NeverUsed' is declared but never used

This is only a warning the csc compiler will still compile the program.