Click here to Skip to main content
15,899,126 members
Home / Discussions / C#
   

C#

 
GeneralRe: Could not load file or assembly from package installed from nuget Pin
Member 156340715-May-24 12:31
Member 156340715-May-24 12:31 
GeneralRe: Could not load file or assembly from package installed from nuget Pin
OriginalGriff5-May-24 19:04
mveOriginalGriff5-May-24 19:04 
QuestionHow to "link" a referenced dll to a third party dll I develop. Pin
AtaChris1-May-24 8:47
AtaChris1-May-24 8:47 
AnswerRe: How to "link" a referenced dll to a third party dll I develop. Pin
Dave Kreskowiak1-May-24 10:37
mveDave Kreskowiak1-May-24 10:37 
GeneralRe: How to "link" a referenced dll to a third party dll I develop. Pin
AtaChris1-May-24 18:06
AtaChris1-May-24 18:06 
GeneralRe: How to "link" a referenced dll to a third party dll I develop. Pin
Dave Kreskowiak2-May-24 3:36
mveDave Kreskowiak2-May-24 3:36 
QuestionPerformance of Switch case vs dictionary with delegates Pin
Jörgen Andersson29-Apr-24 4:29
professionalJörgen Andersson29-Apr-24 4:29 
AnswerRe: Performance of Switch case vs dictionary with delegates Pin
trønderen29-Apr-24 5:53
trønderen29-Apr-24 5:53 
Let me add to that question - not using a lookup dictionary, but a 2D array:

I regularly see people claim that they program in a 'state machine' fashion (breaking numerous rules for state machine programming, but that's not the question here), essentially as a switch or sequence of if-else on the event, each switch/else alternative being another switch/if-else on the current state. I find that coding style terrible, impossible to maintain.

My coding style for state machines is creating a 2D array of Action and Output delegate references and a NextState value, possibly headed by a predicate delegate reference (so the array becomes a 2,5D one). In the worst case, three delegates must be called, plus one per failing predicate. In the simplest case, a single delegate is called (no predicate, no output).

Obviously, there is also the initial indexing of the state table on event and state, and if the entry has a chain of predicated alternatives, the code to iterate over them. This is part of the basic transition mechanism, unrelated to the specific table/transition.

This way of coding state machines has so many advantages that I will be very reluctant to change it. Yet I wonder: Is this indexing and delegate calling a CPU costly way of doing it, compared to nesting of switch / if-else in 2-3 levels? Are there performance pitfalls I should be aware of when indexing / calling delegates?

Religious freedom is the freedom to say that two plus two make five.

AnswerRe: Performance of Switch case vs dictionary with delegates Pin
jschell29-Apr-24 14:43
jschell29-Apr-24 14:43 
AnswerRe: Performance of Switch case vs dictionary with delegates Pin
Rob Philpott29-Apr-24 22:45
Rob Philpott29-Apr-24 22:45 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
Jörgen Andersson29-Apr-24 23:19
professionalJörgen Andersson29-Apr-24 23:19 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
Richard Deeming30-Apr-24 0:12
mveRichard Deeming30-Apr-24 0:12 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
Rob Philpott30-Apr-24 0:22
Rob Philpott30-Apr-24 0:22 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
Jörgen Andersson30-Apr-24 2:15
professionalJörgen Andersson30-Apr-24 2:15 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
Rob Philpott30-Apr-24 0:17
Rob Philpott30-Apr-24 0:17 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
Jörgen Andersson30-Apr-24 3:14
professionalJörgen Andersson30-Apr-24 3:14 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
Jörgen Andersson30-Apr-24 4:22
professionalJörgen Andersson30-Apr-24 4:22 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
Rob Philpott30-Apr-24 4:27
Rob Philpott30-Apr-24 4:27 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
jschell30-Apr-24 12:17
jschell30-Apr-24 12:17 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
Jörgen Andersson1-May-24 8:21
professionalJörgen Andersson1-May-24 8:21 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
Jörgen Andersson1-May-24 8:49
professionalJörgen Andersson1-May-24 8:49 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
Richard Deeming1-May-24 21:47
mveRichard Deeming1-May-24 21:47 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
trønderen2-May-24 6:50
trønderen2-May-24 6:50 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
Richard Deeming2-May-24 21:39
mveRichard Deeming2-May-24 21:39 
GeneralRe: Performance of Switch case vs dictionary with delegates Pin
Rob Philpott2-May-24 23:57
Rob Philpott2-May-24 23:57 

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.