Assign enum value from a member and variable : enum « Data Type « C# / CSharp Tutorial

C# / CSharp Tutorial
1. Language Basics
2. Data Type
3. Operator
4. Statement
5. String
6. struct
7. Class
8. Operator Overload
9. delegate
10. Attribute
11. Data Structure
12. Assembly
13. Date Time
14. Development
15. File Directory Stream
16. Preprocessing Directives
17. Regular Expression
18. Generic
19. Reflection
20. Thread
21. I18N Internationalization
22. GUI Windows Forms
23. 2D
24. Design Patterns
25. Windows
26. XML
27. ADO.Net
28. Network
29. Directory Services
30. Security
31. unsafe
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
C# / CSharp Tutorial » Data Type » enum 
2. 35. 13. Assign enum value from a member and variable
 

using System;

enum Color
{
   Green,
   Yellow,
   Red
}

class MainClass
{
   static void Main()
   {
      Color t1 = Color.Red;     
      Color t2 = Color.Green;   
      Color t3 = t2;                   

      Console.WriteLine(t1);
      Console.WriteLine(t2);
      Console.WriteLine(t3);
   }
}

        
Red
Green
Green
  
2. 35. enum
2. 35. 1. Enumerations
2. 35. 2. Declaration of enum data type
2. 35. 3. Define constants with const keywords and enum
2. 35. 4. Readonly Fields with enum
2. 35. 5. Use enum type categorize objects
2. 35. 6. Pass enum data to a method
2. 35. 7. Assign int value to enumerations
2. 35. 8. Enumerations Initialization with calculation
2. 35. 9. Enumerations Initialization with integer value
2. 35. 10. Output enum element value
2. 35. 11. Loop through the enum data type
2. 35. 12. Use an enumeration to index an array
2. 35. 13. Assign enum value from a member and variable
2. 35. 14. Use enum data as flags
w__w___w._j__a__v_a___2s___.___c___o_m | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.