Click here to Skip to main content
15,559,491 members
Home / Discussions / C#
   

C#

 
QuestionHow can I monitor CPU and monitor utilisation for 1 process and plot in the graph Pin
anujlamba19-Jul-16 3:39
anujlamba19-Jul-16 3:39 
AnswerRe: How can I monitor CPU and monitor utilisation for 1 process and plot in the graph Pin
Richard MacCutchan19-Jul-16 4:11
mveRichard MacCutchan19-Jul-16 4:11 
QuestionSet RequestValidationMode at control level in web config Pin
Member 1264210518-Jul-16 22:22
Member 1264210518-Jul-16 22:22 
AnswerRe: Set RequestValidationMode at control level in web config Pin
Slacker00719-Jul-16 3:09
professionalSlacker00719-Jul-16 3:09 
SuggestionAbout Async Event Pin
Super Lloyd18-Jul-16 15:47
Super Lloyd18-Jul-16 15:47 
GeneralRe: About Async Event Pin
Brisingr Aerowing18-Jul-16 17:16
professionalBrisingr Aerowing18-Jul-16 17:16 
GeneralRe: About Async Event Pin
Super Lloyd18-Jul-16 17:57
Super Lloyd18-Jul-16 17:57 
GeneralRe: About Async Event Pin
Marc Clifton19-Jul-16 2:07
mvaMarc Clifton19-Jul-16 2:07 
eAlarmReceived += value;

You can treat Func<Task> as a multicast delegate? I had no idea.

I've been playing around with this, and I'm not sure of the usage:
static void Main(string[] args)
{
    new Program();
    Console.ReadLine();
}

public Program()
{
    DoIt();
}

public async void DoIt()
{
    AlarmReceived += () => new Task(() => Console.WriteLine("A"));
    AlarmReceived += () => new Task(() => Console.WriteLine("B"));
    await OnAlarm();
}

That compiles but "A" and "B" never print -- what's a simple example of adding tasks to AlarmReceived?

[edit]
Never mind, I see what I was doing wrong. This works:
AlarmReceived += () => Task.Run(() => Console.WriteLine("A"));
AlarmReceived += () => Task.Run(() => Console.WriteLine("B"));

Now on to your question...

Marc
Imperative to Functional Programming Succinctly

Contributors Wanted for Higher Order Programming Project!

Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny

GeneralRe: About Async Event Pin
Super Lloyd19-Jul-16 3:44
Super Lloyd19-Jul-16 3:44 
GeneralRe: About Async Event Pin
Marc Clifton19-Jul-16 2:50
mvaMarc Clifton19-Jul-16 2:50 
GeneralRe: About Async Event Pin
Richard Deeming19-Jul-16 2:55
mveRichard Deeming19-Jul-16 2:55 
AnswerRe: About Async Event Pin
Super Lloyd19-Jul-16 4:07
Super Lloyd19-Jul-16 4:07 
GeneralRe: About Async Event Pin
Super Lloyd19-Jul-16 4:19
Super Lloyd19-Jul-16 4:19 
GeneralRe: About Async Event Pin
Super Lloyd19-Jul-16 15:32
Super Lloyd19-Jul-16 15:32 
GeneralRe: About Async Event Pin
Richard Deeming20-Jul-16 2:51
mveRichard Deeming20-Jul-16 2:51 
GeneralRe: About Async Event Pin
Super Lloyd20-Jul-16 3:08
Super Lloyd20-Jul-16 3:08 
GeneralRe: About Async Event Pin
Richard Deeming19-Jul-16 2:54
mveRichard Deeming19-Jul-16 2:54 
GeneralRe: About Async Event Pin
Super Lloyd19-Jul-16 3:55
Super Lloyd19-Jul-16 3:55 
QuestionHow can I run multiple powershell commands in a C#/powershell runspace? Pin
turbosupramk318-Jul-16 5:02
turbosupramk318-Jul-16 5:02 
QuestionRe: How can I run multiple powershell commands in a C#/powershell runspace? Pin
Richard MacCutchan18-Jul-16 5:22
mveRichard MacCutchan18-Jul-16 5:22 
AnswerRe: How can I run multiple powershell commands in a C#/powershell runspace? Pin
turbosupramk318-Jul-16 5:35
turbosupramk318-Jul-16 5:35 
GeneralRe: How can I run multiple powershell commands in a C#/powershell runspace? Pin
Richard MacCutchan18-Jul-16 5:51
mveRichard MacCutchan18-Jul-16 5:51 
GeneralRe: How can I run multiple powershell commands in a C#/powershell runspace? Pin
turbosupramk318-Jul-16 5:58
turbosupramk318-Jul-16 5:58 
GeneralRe: How can I run multiple powershell commands in a C#/powershell runspace? Pin
Richard MacCutchan18-Jul-16 7:15
mveRichard MacCutchan18-Jul-16 7:15 
GeneralRe: How can I run multiple powershell commands in a C#/powershell runspace? Pin
turbosupramk318-Jul-16 8:49
turbosupramk318-Jul-16 8:49 

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.