Arthur Charlton

@LynxStar

Joined on Mar 18, 2024

  • public void Foo<TValue>(TValue x) where TValue : new() { var x = new TValue(); } public void Main() { Foo(42); Foo("asdlkjadsf"); Foo(0.234);
     Like  Bookmark
  • //Normal C# argument X must be nominally int public void Foo(int x) //With claims constraints public void Foo(int x) where x < 10 //You can't call the function without providing claims that //meet the constraint Foo(5)//Literal is compile time known to meet it Foo(15)//Fails
     Like  Bookmark