Click here to Skip to main content
15,910,130 members
Home / Discussions / C#
   

C#

 
AnswerRe: Communication "Server / Service" for older .NET Framework application Pin
jschell6-May-24 15:01
jschell6-May-24 15:01 
GeneralRe: Communication "Server / Service" for older .NET Framework application Pin
HobbyProggy7-May-24 21:49
professionalHobbyProggy7-May-24 21:49 
AnswerRe: Communication "Server / Service" for older .NET Framework application Pin
Richard Deeming6-May-24 21:36
mveRichard Deeming6-May-24 21:36 
GeneralRe: Communication "Server / Service" for older .NET Framework application Pin
HobbyProggy7-May-24 21:55
professionalHobbyProggy7-May-24 21:55 
GeneralRe: Communication "Server / Service" for older .NET Framework application Pin
Richard Deeming7-May-24 22:32
mveRichard Deeming7-May-24 22:32 
GeneralRe: Communication "Server / Service" for older .NET Framework application Pin
HobbyProggy7-May-24 23:46
professionalHobbyProggy7-May-24 23:46 
AnswerRe: Communication "Server / Service" for older .NET Framework application Pin
lmoelleb8-May-24 7:08
lmoelleb8-May-24 7:08 
GeneralRe: Communication "Server / Service" for older .NET Framework application Pin
jschell11-May-24 9:50
jschell11-May-24 9:50 
QuestionCould not load file or assembly from package installed from nuget Pin
Member 156340714-May-24 20:20
Member 156340714-May-24 20:20 
AnswerRe: Could not load file or assembly from package installed from nuget Pin
OriginalGriff5-May-24 3:28
mveOriginalGriff5-May-24 3:28 
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 

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.