Click here to Skip to main content
15,903,632 members
Home / Discussions / C#
   

C#

 
QuestionThanks Pin
Oluwayomi8-May-08 3:27
Oluwayomi8-May-08 3:27 
AnswerRe: Thanks Pin
J4amieC8-May-08 3:30
J4amieC8-May-08 3:30 
QuestionTo the whole commuity(solve this) Pin
Oluwayomi8-May-08 3:07
Oluwayomi8-May-08 3:07 
AnswerRe: To the whole commuity(solve this) Pin
Pete O'Hanlon8-May-08 3:12
mvePete O'Hanlon8-May-08 3:12 
AnswerRe: To the whole commuity(solve this) Pin
phannon868-May-08 3:20
professionalphannon868-May-08 3:20 
AnswerRe: To the whole commuity(solve this) Pin
Ashfield8-May-08 3:21
Ashfield8-May-08 3:21 
AnswerRe: To the whole commuity(solve this) Pin
Gareth H8-May-08 3:23
Gareth H8-May-08 3:23 
QuestionIssues making a generic class with System.Enum as a parameter [modified] Pin
carbon_golem8-May-08 2:47
carbon_golem8-May-08 2:47 
What I'd like to be able to do is make a generic class for hardware status words where every bit in the word corresponds to a boolean named flag. I'd like to have something that would take advantage of the underlying type of the enum as well as some attributes that I'm tagging onto the enum. I thought I'd be able to do that, but I'm not having very much luck at it. I guess the enum is just being used as a template which is what I want. The question is, is it possible to take advantage of some of the enum features in a generic class?

Example target code:
enum AlarmTemplate : byte {
    [Description("High Liquid Level")]
    HighLevel,
    [Description("Low Liquid Level")]
    LowLevel
}
Byte theStatus = 0xA5;
StatusWord<<AlarmTemplate>> word = new StatusWord<<AlarmTemplate>>(theStatus); // where i can pass in the underlying type as an initializer
word.Bit[AlarmTemplate.HighLevel] = false; // Indexer
Byte temp = word.UnderlyingValue; // returns the enum's underlying type

I've always made custom classes to support all of these things, and lately I'm getting tired of it. Any ideas?

Scott P

“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra

modified on Thursday, May 8, 2008 11:03 AM

AnswerRe: Issues making a generic class with System.Enum as a parameter Pin
S. Senthil Kumar8-May-08 6:05
S. Senthil Kumar8-May-08 6:05 
AnswerRe: Issues making a generic class with System.Enum as a parameter Pin
PIEBALDconsult8-May-08 14:54
mvePIEBALDconsult8-May-08 14:54 
GeneralRe: Issues making a generic class with System.Enum as a parameter Pin
carbon_golem9-May-08 2:43
carbon_golem9-May-08 2:43 
GeneralRe: Issues making a generic class with System.Enum as a parameter Pin
PIEBALDconsult9-May-08 12:23
mvePIEBALDconsult9-May-08 12:23 
QuestionJPEG EXIF metadata Pin
Jim Warburton8-May-08 2:40
Jim Warburton8-May-08 2:40 
AnswerRe: JPEG EXIF metadata Pin
Luc Pattyn8-May-08 6:34
sitebuilderLuc Pattyn8-May-08 6:34 
QuestionConverting an excel spreadsheet to PDF Pin
Sue68-May-08 2:34
Sue68-May-08 2:34 
AnswerRe: Converting an excel spreadsheet to PDF Pin
Harvey Saayman8-May-08 4:52
Harvey Saayman8-May-08 4:52 
QuestionC# code to triple a number Pin
Oluwayomi8-May-08 2:20
Oluwayomi8-May-08 2:20 
AnswerRe: C# code to triple a number Pin
J4amieC8-May-08 2:22
J4amieC8-May-08 2:22 
GeneralRe: C# code to triple a number Pin
Christian Graus8-May-08 2:24
protectorChristian Graus8-May-08 2:24 
GeneralRe: C# code to triple a number Pin
Xmen Real 8-May-08 2:32
professional Xmen Real 8-May-08 2:32 
AnswerRe: C# code to triple a number Pin
Christian Graus8-May-08 2:24
protectorChristian Graus8-May-08 2:24 
GeneralRe: C# code to triple a number Pin
dan!sh 8-May-08 2:28
professional dan!sh 8-May-08 2:28 
AnswerRe: C# code to triple a number Pin
Pete O'Hanlon8-May-08 2:26
mvePete O'Hanlon8-May-08 2:26 
AnswerRe: C# code to triple a number Pin
#realJSOP8-May-08 2:50
professional#realJSOP8-May-08 2:50 
AnswerRe: C# code to triple a number Pin
BadKarma8-May-08 2:51
BadKarma8-May-08 2:51 

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.