यह एन्यूमरेशन में स्थिरांकों के नामों की एक सरणी प्राप्त करता है। निम्न सिंटैक्स है:
Enum.GetNames(Type)
यहां, Type एक एन्यूमरेशन प्रकार है।
निम्न एक उदाहरण है:
उदाहरण
using System;
class Demo {
enum Vehicle {
Car,
Motorbike,
Truck,
};
static void Main() {
// एन्यूम प्रदर्शित करें
foreach (string res in Enum.GetNames(typeof(Vehicle)))
Console.WriteLine(res);
}
}
आउटपुट
Car Motorbike Truck