You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static class StringExtensions1 {
//Doesn't compile -- "The parameter modifier cannot be used with 'this'"
public static void Fill(this ref string s) {
if (s == null) {s="";}
}
}
public static class StringExtensions2 {
//Doesn't compile -- "Do not use 'System.Runtime.CompilerServices.ExtensionAttribute'. Use 'this' keyword instead"
[Extension] public static void Fill(ref string s, int count) {
if (s == null) {s="";}
}
}
Version Used:
C# 6.0
Steps to Reproduce:
Additional example with auto-initializing dictionary.
Expected Behavior:
Either syntax should compile and run.
Actual Behavior:
Neither syntax compiles.
The text was updated successfully, but these errors were encountered: