• /r/csharp
  • TIL – Attributes placed on a class have access to private class members.

    I’m no expert developer or anything, but I’m getting to the point where I’m pretty familiar with C#, and I just randomly ran into a language “feature” today I never knew about. Attribute parameters, when placed on a class, have access to that class’s static members, even private ones. Example: [Demonstration(stringParam: ConstantControllerString)] public class MyController […]

  • /r/csharp
  • UnobservedTaskException. What am I missing? Why is the event not fireing?

    Thats the mockup code: Task t3 will have ample time to finish and throw an Exception in the background. Since it is not waited with t3.Wait() its exception is unhandled and should be collected to be signalled by UnobservedTaskException event. using System; using System.Threading.Tasks; using System.Threading; class Program { static void ThrowEx() { throw null; […]