C
C#16mo ago
Simon

❔ StringSyntax attribute not available

Yesterday I updated VS to the latest version and installed .NET SDK 7 but whenever I try to use [StringSyntax(StringSyntaxAttribute.Regex)] on a parameter, VS doesn't seem to be able to find it for importing. My project uses .net v4.8.1 framework.
4 Replies
jcotton42
jcotton4216mo ago
You'll need to polyfill it Something like PolySharp from nuget will do the trick Though, why target 4.8.1 in this day and age?
Angius
Angius16mo ago
You use the old .NET Framework 4.8, so you will only ever get the features of the old .NET Framework 4.8 You could go into the future, get .NET 69 SDK installer, go back, install them, it would not change things
Simon
SimonOP16mo ago
I just upgraded to .net 7, apparently that attribute doesn't even work on string arrays, well that's it i guess :P Oh it does work, it just stops working if you use variables with it or just a simple
new string[] { "hey" + "(test|non) .*" }
new string[] { "hey" + "(test|non) .*" }
that kinda makes sense, but it'd be still useless for me
Accord
Accord16mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server