Discussion Forum : enums

How to add extension methods to Enums
I have this Enum code: enum Duration { Day, Week, Month };  Can I add a extension methods for this Enum?
 Upvotes: 0   Answers: 0
Getting the integer value from enum
I am working on a basic Battleship game to help my C# skills. Right now I am having a little trouble with enum. I have: ... View Detail
 Upvotes: 0   Answers: 0
Sharing Enum with WCF Service
I have few different applications among which I'd like to share a C# enum. I can't quite figure out how to share an enum ... View Detail
 Upvotes: 0   Answers: 0
How to get the values of an enum into a SelectList
Imagine I have an enumeration such as this (just as an example): public enum Direction{  Horizontal = 0,  Vertical = 1, ... View Detail
 Upvotes: 0   Answers: 0
How to compare enum and int values?
enum MyEnum {  Invalid=0,  Value1=1,  Value1=2, }  void main () {  MyEnum e1 = MyEnum.Value1;  int i1 = 2;   // Is there ... View Detail
 Upvotes: 0   Answers: 0
How to get an array of all enum values in C#?
I have an enum that I'd like to display all possible values of. Is there a way to get an array or list of all the possib ... View Detail
 Upvotes: 0   Answers: 0
Convert List to IEnumerable<SelectListItem>
Tricky problem here. I'm trying to convert items for a list to IEnumerable<SelectListItem>. Lists dynamicTextInDatabas ... View Detail
 Upvotes: 0   Answers: 0
C# Enum - How to Compare Value
How can I compare the value of this enum public enum AccountType {  Retailer = 1,  Customer = 2,  Manager = 3,  Employe ... View Detail
 Upvotes: 0   Answers: 0
Convert an enum to List<string>
How do I convert the following Enum to a List of strings? [Flags] public enum DataSourceTypes {  None = 0,  Grid = 1,   ... View Detail
 Upvotes: 0   Answers: 0
How do I select a random value from an enumeration?
Given an arbitrary enumeration in C#, how do I select a random value? (I did not find this very basic question on SO. I ... View Detail
 Upvotes: 0   Answers: 0
How do you pass multiple enum values in C#?
Sometimes when reading others' C# code I see a method that will accept multiple enum values in a single parameter. I alw ... View Detail
 Upvotes: 0   Answers: 0
Pass in an enum as a method parameter
I have declared an enum: public enum SupportedPermissions {  basic,  repository,  both }  I also have a POCO like this ... View Detail
 Upvotes: 0   Answers: 0
convert an enum to another type of enum
I have an enum of for example 'Gender' (Male =0 , Female =1) and I have another enum from a service which has its own Ge ... View Detail
 Upvotes: 0   Answers: 0
How to Compare Flags in C#?
I have a flag enum below. [Flags] public enum FlagTest {  None = 0x0,  Flag1 = 0x1,  Flag2 = 0x2,  Flag3 = 0x4 }  I ca ... View Detail
 Upvotes: 0   Answers: 0
How to TryParse for Enum value?
I want to write a function which can validate a given value (passed as a string) against possible values of an enum. In ... View Detail
 Upvotes: 0   Answers: 0
How to get the Enum Index value in C#
In C, enums, internally equates to an integer. Therefore we can treat data types of enum as integer also. How to achiev ... View Detail
 Upvotes: 0   Answers: 0
Enum Naming Convention - Plural
I'm asking this question despite having read similar but not exactly what I want at C# naming convention for enum and ma ... View Detail
 Upvotes: 0   Answers: 0
What is the KeyCode for ,(comma) and .(dot) in .NET?
In my KeyDown EventHandler I need to know what is the KeyCode for , and .. I can't find them thats why I ask. Thanks!
 Upvotes: 0   Answers: 0
How do I have an enum bound combobox with custom string formatting for enum values?
In the post Enum ToString, a method is described to use the custom attribute DescriptionAttribute like this: Enum HowNi ... View Detail
 Upvotes: 0   Answers: 0
How to get a enum value from string in C#?
I have an enum: public enum baseKey : uint {    HKEY_CLASSES_ROOT = 0x80000000,  HKEY_CURRENT_USER = 0x80000001,  HKEY_ ... View Detail
 Upvotes: 0   Answers: 0
Casting string to enum
I'm reading file content and take string at exact location like this  string fileContentMessage = File.ReadAllText(file ... View Detail
 Upvotes: 0   Answers: 0
How to convert from System.Enum to base integer?
I'd like to create a generic method for converting any System.Enum derived type to its corresponding integer value, with ... View Detail
 Upvotes: 0   Answers: 0
what is the default value for enum variable
An enum variable, anyone know if it is always defaulting to the first element?
 Upvotes: 0   Answers: 0
C# int to enum conversion
Possible Duplicate: Cast int to enum in C# If I have the following code: enum foo : int {  option1 = 1,  opt ... View Detail
 Upvotes: 0   Answers: 0
C# Public Enums in Classes
I have a program with a class that contains a public enum, as follows: public class Card {  public enum card_suits  {   ... View Detail
 Upvotes: 0   Answers: 0

Quick Links



Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..


Login to Open ESchool OR Create your account    Login   SignUp