This statement could be extremely confusing to new comers as it doesn't make sense in the context in which it is used: Logger.WriteMessage += LogToConsole;
It should be: Logger.WriteMessage += Logger.LogToConsole;
Also, In general these examples are confusing and lack essential information in both description and example content.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thanks for adding this @SalFicara
We'll make sure to address this when we next update this document.
In the meantime, I've added the "up for grabs" label for any community members to address.
Actually, if you have a closer look to the full sample here, the line of code you pointed out is correct.
However I agree with you @SalFicara on the fact that the way it is explained in the article is quite confusing as we can't really understand where the LogToConsole method is located in the example program.
@BillWagner , based on the sample, it looks alright. Is this a bug or not?
@eddynaka
The previous comment is correct. The code is correct, but the explanation does not help readers find that information.
@BillWagner so should we change the code or explanation?
As the code is correct, we should rephrase the explanation only
I attempted to address this in two PRs across the docs & the samples.
LoggingMethods so that we could show the full context of the class within the docs sample.LogToConsole methodLoggingMethods out of context, to remind the reader it's one we created earlier.Feedback on the overall approach welcome, but this seemed to find the sweet spot of: