Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
QuestionDe-smellifying some code... Pin
martin_hughes16-Aug-07 6:56
martin_hughes16-Aug-07 6:56 
AnswerRe: De-smellifying some code... Pin
MidwestLimey16-Aug-07 7:24
professionalMidwestLimey16-Aug-07 7:24 
GeneralRe: De-smellifying some code... Pin
martin_hughes16-Aug-07 12:12
martin_hughes16-Aug-07 12:12 
GeneralRe: De-smellifying some code... Pin
Luc Pattyn16-Aug-07 13:03
sitebuilderLuc Pattyn16-Aug-07 13:03 
GeneralRe: De-smellifying some code... Pin
martin_hughes17-Aug-07 6:50
martin_hughes17-Aug-07 6:50 
GeneralRe: De-smellifying some code... Pin
MidwestLimey16-Aug-07 17:20
professionalMidwestLimey16-Aug-07 17:20 
AnswerRe: De-smellifying some code... Pin
PhilDanger16-Aug-07 8:15
PhilDanger16-Aug-07 8:15 
AnswerRe: De-smellifying some code... Pin
Leslie Sanford16-Aug-07 12:35
Leslie Sanford16-Aug-07 12:35 
martin_hughes wrote:
One part of the program reads data in from a file, and depending on the value read in, decides on a course of action. The decision is made by a slect case statement


Actually, this is one of those places where a select statement is appropriate. When reading raw data from a file, you are at the boundary of your application. As such, the data doesn't represent objects that you can manipulate, so you are forced to use conditionals to decide what to do. Usually, the course of action is to create an object to encapsulate the data. From there, the rest of the application deals with the object(s) rather than the raw data, and you can design your classes in such a way as to take advantage of polymorphism. But at the boundary of your application, you need a way to interpret the data and transform it into objects. switch/select statements are fine for this.

Now having said all of that, if you can figure out a way to serialize the data to file so that it can be deserialized directly into objects by your environment, then cool. Otherwise, don't be bothered by the switch/select statements.

All my opinion, of course. Smile | :)
Questionanonymous method runs "too many times" Pin
gericooper16-Aug-07 5:53
gericooper16-Aug-07 5:53 
AnswerRe: anonymous method runs "too many times" [modified] Pin
Luc Pattyn16-Aug-07 6:45
sitebuilderLuc Pattyn16-Aug-07 6:45 
GeneralRe: anonymous method runs "too many times" Pin
gericooper16-Aug-07 20:26
gericooper16-Aug-07 20:26 
Questionlayers (?) Pin
tim_gunning16-Aug-07 5:52
tim_gunning16-Aug-07 5:52 
AnswerRe: layers (?) Pin
Mark Churchill16-Aug-07 15:54
Mark Churchill16-Aug-07 15:54 
QuestionSelect Method of DataSet - pls help Pin
meeram39516-Aug-07 5:48
meeram39516-Aug-07 5:48 
AnswerRe: Select Method of DataSet - pls help Pin
Giorgi Dalakishvili16-Aug-07 6:02
mentorGiorgi Dalakishvili16-Aug-07 6:02 
AnswerRe: Select Method of DataSet - pls help Pin
kboyette16-Aug-07 10:57
kboyette16-Aug-07 10:57 
QuestionWindows Mobile Applications Pin
Harkamal Singh16-Aug-07 4:57
Harkamal Singh16-Aug-07 4:57 
AnswerRe: Windows Mobile Applications Pin
Not Active16-Aug-07 9:14
mentorNot Active16-Aug-07 9:14 
Question3Gp to MPEG4 convertor [modified] Pin
kibromg16-Aug-07 4:23
kibromg16-Aug-07 4:23 
QuestionExtending frame into client area on Vista using the Aero Basic theme Pin
Scott Dorman16-Aug-07 3:24
professionalScott Dorman16-Aug-07 3:24 
AnswerRe: Extending frame into client area on Vista using the Aero Basic theme Pin
seeitsharper16-Aug-07 23:48
seeitsharper16-Aug-07 23:48 
GeneralRe: Extending frame into client area on Vista using the Aero Basic theme Pin
Scott Dorman17-Aug-07 4:31
professionalScott Dorman17-Aug-07 4:31 
GeneralRe: Extending frame into client area on Vista using the Aero Basic theme Pin
seeitsharper17-Aug-07 5:23
seeitsharper17-Aug-07 5:23 
QuestionHow to retrieve files from "System Volume Information" Folder Pin
ramesh_nrk16-Aug-07 3:13
ramesh_nrk16-Aug-07 3:13 
AnswerRe: How to retrieve files from "System Volume Information" Folder Pin
Martin#16-Aug-07 3:19
Martin#16-Aug-07 3:19 

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.