السلام عليكم ورحمة الله وبركاته
بينما كنت أقرأ في الـ MSDN
وجدت هذا المثال وهنا شي لم أفهمه الرجاء توضيح الخطوط الحمراء
using System;
public class ParseTest {
[FlagsAttribute]
enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 };
public static void Main() {
Console.WriteLine("The entries of the Colors Enum are:");
foreach(string s in Enum.GetNames(typeof(Colors)))
Console.WriteLine(s);
Console.WriteLine();
Colors myOrange = (Colors)Enum.Parse(typeof(Colors), "Red, Yellow");
Console.WriteLine("The myOrange value has the combined entries of {0}", myOrange);
}
}
خاصة سبب استعمال رقم صفر في السطر الأخير من الكود
هذا اكود موجود في الـ MSDN
عند البحث على ENUM.PARSE
ولكم جزيل الشكر
سبحان الله وبحمده سبحان الله العظيم