Reputation: 11693
When I try and compile this code, I get this error.
Error 1 The type or namespace name 'transmission' could not be found (are you missing a using directive or an assembly reference?)
How will I be able to rectify this error?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
public enum transmission
{
Manual,
NonSynchronous,
Automatic,
SemiAutomatic,
Continuously,
Infinitely,
Electric,
Hydrostatic,
Hydrodynamic,
}
}
public class Car
{
static void Main(string[] args)
{
string[] transmissions = Enum.GetNames(typeof(transmission));
foreach(String transmission in transmissions) {
Console.WriteLine(transmission);
}
}
}
Upvotes: 1
Views: 1182
Reputation: 1539
You are outside the scope of ConsoleApplication1
namespace. Either include Car
class to that namespace or call typeof(ConsoleApplication1.transmission)
.
Upvotes: 6