Click here to Skip to main content
15,924,507 members
Home / Discussions / C#
   

C#

 
AnswerRe: Cancel on ThreadPool queued executions? Pin
Harvey Saayman10-Oct-10 21:29
Harvey Saayman10-Oct-10 21:29 
GeneralRe: Cancel on ThreadPool queued executions? Pin
devvvy11-Oct-10 2:49
devvvy11-Oct-10 2:49 
GeneralRe: Cancel on ThreadPool queued executions? Pin
Harvey Saayman11-Oct-10 2:52
Harvey Saayman11-Oct-10 2:52 
AnswerRe: Cancel on ThreadPool queued executions? Pin
Luc Pattyn11-Oct-10 1:23
sitebuilderLuc Pattyn11-Oct-10 1:23 
GeneralRe: Cancel on ThreadPool queued executions? Pin
devvvy11-Oct-10 3:03
devvvy11-Oct-10 3:03 
GeneralRe: Cancel on ThreadPool queued executions? Pin
Luc Pattyn11-Oct-10 3:15
sitebuilderLuc Pattyn11-Oct-10 3:15 
QuestionSeperate conversion functions or 1 overloaded function? Pin
stephen.darling10-Oct-10 3:23
stephen.darling10-Oct-10 3:23 
AnswerRe: Seperate conversion functions or 1 overloaded function? Pin
PIEBALDconsult10-Oct-10 4:18
mvePIEBALDconsult10-Oct-10 4:18 
Hmmm...

You should probably have an enumeration that contains the supported units and have one method that takes the magnitude and two units.

But you could also provide separate methods and the above method could just be a switching station -- but with Dictionaries, not switches.

private static Dictionary<FromUnit,Dictionary<ToUnit,delegate>> dic ... ;

dic [ Unit.Grams ] = ... ;
dic [ Unit.Grams ] [ MilliGrams ] = ConvertGramsToMilliGrams ;

...

return ( dic [ FromUnit ] [ ToUnit ] ( Magnitude ) ) ;


Actually, the populating of the Dictionary can be automated -- perhaps create an Attribute to decorate your methods:

[UnitConvertorAttribute ( From , To )]
public double ConvertGramsToMilliGrams ( double Magnitude , Unit From Unit To ) ...

AnswerRe: Seperate conversion functions or 1 overloaded function? Pin
Abhinav S10-Oct-10 6:04
Abhinav S10-Oct-10 6:04 
GeneralRe: Seperate conversion functions or 1 overloaded function? Pin
stephen.darling10-Oct-10 7:22
stephen.darling10-Oct-10 7:22 
GeneralRe: Seperate conversion functions or 1 overloaded function? [modified] Pin
Not Active10-Oct-10 9:28
mentorNot Active10-Oct-10 9:28 
AnswerRe: Seperate conversion functions or 1 overloaded function? Pin
Eddy Vluggen10-Oct-10 11:34
professionalEddy Vluggen10-Oct-10 11:34 
GeneralRe: Seperate conversion functions or 1 overloaded function? Pin
PIEBALDconsult10-Oct-10 14:14
mvePIEBALDconsult10-Oct-10 14:14 
GeneralRe: Seperate conversion functions or 1 overloaded function? Pin
Eddy Vluggen10-Oct-10 20:37
professionalEddy Vluggen10-Oct-10 20:37 
QuestionRetrieving a DataTable from a Collection by name Pin
boreland10-Oct-10 1:02
boreland10-Oct-10 1:02 
AnswerRe: Retrieving a DataTable from a Collection by name Pin
OriginalGriff10-Oct-10 1:12
mveOriginalGriff10-Oct-10 1:12 
GeneralRe: Retrieving a DataTable from a Collection by name Pin
boreland10-Oct-10 1:20
boreland10-Oct-10 1:20 
GeneralRe: Retrieving a DataTable from a Collection by name Pin
OriginalGriff10-Oct-10 1:23
mveOriginalGriff10-Oct-10 1:23 
AnswerRe: Retrieving a DataTable from a Collection by name Pin
MasttsaM13-Oct-10 21:27
MasttsaM13-Oct-10 21:27 
QuestionControlling a Parallel Port Pin
TowerTurtle9-Oct-10 11:30
TowerTurtle9-Oct-10 11:30 
AnswerRe: Controlling a Parallel Port Pin
PIEBALDconsult9-Oct-10 14:52
mvePIEBALDconsult9-Oct-10 14:52 
QuestionHighscore Pin
SRJ929-Oct-10 9:35
SRJ929-Oct-10 9:35 
AnswerRe: Highscore Pin
PIEBALDconsult9-Oct-10 9:40
mvePIEBALDconsult9-Oct-10 9:40 
JokeRe: Highscore Pin
dan!sh 9-Oct-10 10:32
professional dan!sh 9-Oct-10 10:32 
GeneralRe: Highscore Pin
PIEBALDconsult9-Oct-10 15:53
mvePIEBALDconsult9-Oct-10 15:53 

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.