Using a Enum in C#.net
Code Sample
// declaring a enum
enum Operations
{
add,sub,mul,div
};
public void mymethod()
{
// creating object of enum
Operations op ;
// assinging value to enum
op = Operations.add ;
// using it to compare
if(op== Operations.add)
{
// do somethng.. addition
}
}
Saturday, November 29, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment