Click here to Skip to main content
15,890,579 members
Home / Discussions / C#
   

C#

 
GeneralRe: Point detection Pin
Som Shekhar25-Jan-10 3:55
Som Shekhar25-Jan-10 3:55 
AnswerRe: Point detection Pin
Luc Pattyn25-Jan-10 7:24
sitebuilderLuc Pattyn25-Jan-10 7:24 
QuestionError in WIA Scanning IMage on IIS Project Pin
Hany Salah Abdou24-Jan-10 23:18
Hany Salah Abdou24-Jan-10 23:18 
AnswerRe: Error in WIA Scanning IMage on IIS Project Pin
sharmilakuppuswamy18-Jul-11 19:13
sharmilakuppuswamy18-Jul-11 19:13 
GeneralRe: Error in WIA Scanning IMage on IIS Project Pin
Member 82732918-Aug-13 22:02
Member 82732918-Aug-13 22:02 
QuestionSql Express installed using Package deployment does not provide change 'sa' password option Pin
nilam247724-Jan-10 23:03
nilam247724-Jan-10 23:03 
QuestionAccess managed C++ public enum class from C# by Dynamically loading Pin
mjvalan24-Jan-10 23:01
mjvalan24-Jan-10 23:01 
AnswerRe: Access managed C++ public enum class from C# by Dynamically loading Pin
Eslam Afifi25-Jan-10 0:41
Eslam Afifi25-Jan-10 0:41 
C#
var fields = (from field in type.GetFields() // type is the enum's type (A System.Type)
              where (field.Attributes & System.Reflection.FieldAttributes.Literal) != 0
              select field).ToArray();

// fields[0].GetRawConstantValue() gets the value of the enum's first constant
// fields[0].Name gets the name of the enum's first constant

Don't forget that without enum class or enum struct this code won't work.
The criteria in the where clause assumes that for a CLR enum, no fields other than the enum's constants marked as literal. I'm not completely sure if there are no special cases but you should research that a little bit before trusting that criteria.

Eslam Afifi

GeneralRe: Access managed C++ public enum class from C# by Dynamically loading Pin
Hossam™ Ahmed24-Feb-10 5:50
Hossam™ Ahmed24-Feb-10 5:50 
Questiondisplay digital waveform Pin
MA Awan24-Jan-10 22:54
MA Awan24-Jan-10 22:54 
AnswerRe: display digital waveform Pin
Pete O'Hanlon24-Jan-10 23:22
mvePete O'Hanlon24-Jan-10 23:22 
GeneralRe: display digital waveform Pin
MA Awan24-Jan-10 23:25
MA Awan24-Jan-10 23:25 
Questioncalling image Pin
jojoba201024-Jan-10 22:48
jojoba201024-Jan-10 22:48 
AnswerRe: calling image Pin
OriginalGriff24-Jan-10 23:14
mveOriginalGriff24-Jan-10 23:14 
AnswerRe: calling image Pin
sanforjackass24-Jan-10 23:14
sanforjackass24-Jan-10 23:14 
QuestionRe: calling image Pin
jojoba201024-Jan-10 23:21
jojoba201024-Jan-10 23:21 
AnswerRe: calling image Pin
sanforjackass24-Jan-10 23:31
sanforjackass24-Jan-10 23:31 
QuestionRe: calling image Pin
jojoba201024-Jan-10 23:36
jojoba201024-Jan-10 23:36 
AnswerRe: calling image Pin
sanforjackass25-Jan-10 0:29
sanforjackass25-Jan-10 0:29 
QuestionWinservice installer issue Pin
Priya Prk24-Jan-10 22:11
Priya Prk24-Jan-10 22:11 
AnswerRe: Winservice installer issue Pin
#realJSOP25-Jan-10 0:01
mve#realJSOP25-Jan-10 0:01 
GeneralRe: Winservice installer issue Pin
Priya Prk25-Jan-10 0:05
Priya Prk25-Jan-10 0:05 
QuestionCursor change in WinForms - A generic error occurred in GDI + [modified] Pin
arturw8224-Jan-10 22:04
arturw8224-Jan-10 22:04 
QuestionHow would I go about adding an escape to a predefined string value ? Pin
tonyonlinux24-Jan-10 21:15
tonyonlinux24-Jan-10 21:15 
AnswerRe: How would I go about adding an escape to a predefined string value ? Pin
OriginalGriff24-Jan-10 21:37
mveOriginalGriff24-Jan-10 21:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.