Click here to Skip to main content
15,884,473 members
Home / Discussions / C#
   

C#

 
GeneralRe: Downloading PDF's from website Pin
Covean22-Oct-09 5:07
Covean22-Oct-09 5:07 
GeneralRe: Downloading PDF's from website Pin
Tom Wright22-Oct-09 7:20
Tom Wright22-Oct-09 7:20 
GeneralRe: Downloading PDF's from website Pin
Covean22-Oct-09 21:06
Covean22-Oct-09 21:06 
QuestionAmbiguous constructor signatures? Pin
Clive D. Pottinger22-Oct-09 3:41
Clive D. Pottinger22-Oct-09 3:41 
AnswerRe: Ambiguous constructor signatures? Pin
DaveyM6922-Oct-09 4:58
professionalDaveyM6922-Oct-09 4:58 
GeneralRe: Ambiguous constructor signatures? Pin
Keith Barrow22-Oct-09 5:09
professionalKeith Barrow22-Oct-09 5:09 
GeneralRe: Ambiguous constructor signatures? Pin
Clive D. Pottinger22-Oct-09 7:34
Clive D. Pottinger22-Oct-09 7:34 
GeneralRe: Ambiguous constructor signatures? Pin
Keith Barrow22-Oct-09 11:46
professionalKeith Barrow22-Oct-09 11:46 
Clive D. Pottinger wrote:
The first ctor (MyClass(string initStr)) is used when the initStr holds a formula that needs to be parsed and evaluated to get the value


This is a worry*, and the source of your problem. If possible, you should defer the instantiation of this class until you have the value you want to use. If I understand you correctly, by passing the formula as a string will require the current class to be responsible for performing the parsing as well as whatever this class is meant to do with the result, this is probably bad object encapsulation.

A better way to handle this is to create an object which is responsible for the storage and parsing of the formula, and pass the results of the formula into the current class ,explained in your original post. This will separate the concerns more clearly.


* This is a worry because, unless you are parsing text entries from a user or some other source (e.g. text input from a UI or file), writing formulas in strings and then evaluating them is bad design (and a real pain. If this is the case, then it's unavoidable. If you are just using this to pass formulae around within the application, you should look at c# delegates(which allow you to pass methods around as parameters) and possibly the strategy pattern.

Hope this helps!

CCC solved so far: 2 (including a Hard One!)

GeneralRe: Ambiguous constructor signatures? Pin
Clive D. Pottinger23-Oct-09 6:31
Clive D. Pottinger23-Oct-09 6:31 
Questionproxy server Pin
Zeyad Jalil22-Oct-09 3:28
professionalZeyad Jalil22-Oct-09 3:28 
QuestionReading grayscale values into Bitmap Pin
econner22-Oct-09 2:33
econner22-Oct-09 2:33 
AnswerRe: Reading grayscale values into Bitmap Pin
stancrm22-Oct-09 2:52
stancrm22-Oct-09 2:52 
QuestionFilter Gridview that are bound to an XML file Pin
Ronni Marker22-Oct-09 2:19
Ronni Marker22-Oct-09 2:19 
AnswerRe: Filter Gridview that are bound to an XML file Pin
stancrm22-Oct-09 2:30
stancrm22-Oct-09 2:30 
GeneralRe: Filter Gridview that are bound to an XML file Pin
Ronni Marker22-Oct-09 2:33
Ronni Marker22-Oct-09 2:33 
GeneralRe: Filter Gridview that are bound to an XML file Pin
stancrm22-Oct-09 2:39
stancrm22-Oct-09 2:39 
GeneralRe: Filter Gridview that are bound to an XML file Pin
Ronni Marker22-Oct-09 2:58
Ronni Marker22-Oct-09 2:58 
GeneralRe: Filter Gridview that are bound to an XML file Pin
Henry Minute22-Oct-09 5:59
Henry Minute22-Oct-09 5:59 
GeneralRe: Filter Gridview that are bound to an XML file Pin
Ronni Marker22-Oct-09 6:15
Ronni Marker22-Oct-09 6:15 
Questionconvert .xls file into image file or word image file Pin
Member 438836022-Oct-09 1:24
Member 438836022-Oct-09 1:24 
AnswerRe: convert .xls file into image file or word image file Pin
Ashfield22-Oct-09 1:30
Ashfield22-Oct-09 1:30 
AnswerRe: convert .xls file into image file or word image file Pin
Wes Aday22-Oct-09 4:06
professionalWes Aday22-Oct-09 4:06 
AnswerRe: convert .xls file into image file or word image file Pin
benjymous22-Oct-09 5:03
benjymous22-Oct-09 5:03 
Questionhaving problem in opening Ms Office files into webBrowser Pin
muhammad_umair22-Oct-09 1:08
muhammad_umair22-Oct-09 1:08 
AnswerRe: having problem in opening Ms Office files into webBrowser Pin
Richard MacCutchan22-Oct-09 1:50
mveRichard MacCutchan22-Oct-09 1:50 

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.