C
C#thirteenbinary

❔ How to calculate event expression?

like
c#
var result = a+b-c+d-c+d-b+a;
c#
var result = a+b-c+d-c+d-b+a;
a,b,c,d are all events, and each of them contains more than one method. So what is result like?
T
Thinker400d ago
What type are they?
T
thirteenbinary400d ago
They are events. Like:
c#
delegate void F();
event F a, b, c, d;
c#
delegate void F();
event F a, b, c, d;
T
Thinker400d ago
$tias
T
Thinker400d ago
although I don't know if you can add and subtract delegate types like that
T
thirteenbinary400d ago
But I just see the result but I don't know the rule.
M
MODiX400d ago
thinker227#5176
REPL Result: Success
delegate void F();

F a = () => Console.WriteLine("a");
F b = () => Console.WriteLine("b");
F c = () => Console.WriteLine("c");
F d = () => Console.WriteLine("d");

var result = a + b - c + d - c + d - b + a;
result();
delegate void F();

F a = () => Console.WriteLine("a");
F b = () => Console.WriteLine("b");
F c = () => Console.WriteLine("c");
F d = () => Console.WriteLine("d");

var result = a + b - c + d - c + d - b + a;
result();
Console Output
a
d
d
a
a
d
d
a
Compile: 697.949ms | Execution: 124.181ms | React with ❌ to remove this embed.
T
Thinker400d ago
a + b - c + d - c + d - b + a
a + b - c + d - c + d - b + a
If we think about it like algebra
+ a
+ b
- c (doesn't do anything)
+ d
- c (doesn't do anything)
+ d
- b (removes b)
+ a
+ a
+ b
- c (doesn't do anything)
+ d
- c (doesn't do anything)
+ d
- b (removes b)
+ a
So the result is that + b and - b cancel out, and the - cs don't do anything.
+ a
+ d
+ d
+ a
+ a
+ d
+ d
+ a
T
thirteenbinary400d ago
You dismiss a condition, the event can contain more than one method. I want a more general rule like we know 1+1=2.
A
Accord399d ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
❔ Class Diagram Design questionSo I am doing this design puzzle in Heads First Design Pattern book. So for those who don´t know th✅ telling a console app to exithow do i tell a console app to stop and close the window?❔ I need help for my GameCan everyone help me with my game for my school project, I need help with the scripting? My Code doe❔ Microsoft.XmlSerializer.Generator causes failure to load assembly System.RuntimeHey all, as a way to get my program running under NativeAOT I've been looking into the Microsoft.Xml✅ Make method implemented in interface accessible from implementing typei have an interface ```csharp interface ICL { public IEnumerable<ICLPlatform> GetPlatforms() { ❔ ASP.NET, MongoDB, C#does anyone have experience with c#, mongodb and ASP.NET? I have a project and I need to get data to✅ Is there a working code editor for blazor server?i found one for blazor wasm https://github.com/serdarciplak/BlazorMonaco but that one does not work ✅ Multiple inheritance questionI have a partial class webform that is inheriting a base page class. Inside it there are multiple re❔ How to automatically set version of project to know what version deployed on specific server?The problem is that there is bunch of clients with different versions of .net core and netfx projecthow to make a target that will disappear after shooting a couple of times this is my scripts i havebut it doesnt seem to want to destroy https://paste.mod.gg/mppnwkqnmukq/2❔ ✅ Choosing an appropriate data structureSo I have a list of objects and I want one in the list to be active and the rest to be inactive. I ❔ Saving User DataI have it set up through properties, but I'm having a lot of trouble with showing it on other forms Unsupported statement value type: Microsoft.DotNet.DesignTools.Client.CodeDom.CodeBodyTextStatementhttps://github.com/Jordan-Belfort-88/Audio-Player-1.0/blob/master/Audio%20Player/Form1.Designer.cs IAssert.Raises<> in xUnitI'm trying to create tests for certain events. However it seems that xUnit assumes that I use EventH❔ I have an API function and I want to know what exception it can throw. How can I do that?This is not said in the documentationAmbiguity between 2 things idk how to fixGot an error message all of a sudden saying this when everything was working perfect before so i und❔ Problem populating DatagridI'm trying to populate a datagrid where certain columns are populated with information that is read ❔ Avisynth script maker thingIm trying to make a script that creates AVS files for every file in a Directory based on a template.❔ How to work with Hwnd in c#I want to open programs using Process.Start but all those programs have empty MainWindowHandle and M❔ VS For Mac Code CoverageHas anyone figured out how to show which lines are covered after running unit tests in VS For Mac?