.NET 7 Update: Raw String Literals in 10 Minutes or Less

preview_player
Показать описание
Raw string literals are here in C# 11. And while they look wild, they actually have a good reason for existing. Let's see them in action in this 10-Minute Training video.

Рекомендации по теме
Комментарии
Автор

I mean, that looks really weird but I know I'm gonna love this!
I sometimes have troubles with building patterns in Regex I copied from a builder like Regexr, so I can throw it in like that.
Thank you very much!

Dultus
Автор

Doug DeMuro approves of this quirks and features video for .NET 7 raw string literals.

dasfahrer
Автор

Great video, I can see this being very useful generating specific file types properly (aka CSS, HTML, JavaScript, Python, etc) without a bunch of boilerplate code.

ABMedia
Автор

Things are in fact becoming more complicated as they appear simpler. Over time, we'll need to refactor all the string processing techniques to make life easier.

johnnysong
Автор

This is super helpful! Thanks a ton for such simple explanation. I was honestly too baffled to understand when I first started reading up on it. 👍

ShuklaAayushi
Автор

Finally! I was waiting for it, years now :)

saintinel
Автор

Nice, was recently wanting something like this. Similar to Here-Strings in PowerShell with a bit of a clunkier implementation but more flexibility with the indent. Thanks for these updates.

simon-white
Автор

Learned something new… Thanks for posting

theobellash
Автор

great man thanks it would be very helpful in json parsing and connections pulling.. thanks for tiip

mokshaGyanRam
Автор

Thanks a lot Tim, seems I don't have to use string template4 anymore?

goodmanshawnhuang
Автор

I really wish there was a compiler option or something to enable this for older versions of .NET. I write so much stuff with little SQL and other non-C# code snippets for .NET Framework 4.8 (external requirement; can't be helped). So far I've always just put it as a verbatim literal but I'm constantly fighting with colleagues about the formatting.
Their solution is to put every line of foreign code as a separate string then a + Envrionment.NewLine + at the end and then the next line. I mean yes everything is correctly indented now but it's sooo impractical. Especially if you want to copy things back and forth between editors and the IDE.
And if I indent my verbatim literals I am now the forever keeper of the correct indentation of that bit of code and it's a pain to read while debugging.
Anyway, great video. 👍

crogon-yt
Автор

Finally, the worst thing in C# is fixed for good!

hqcart
Автор

I have a question, does this "Raw String Literals" feature from c#11 or .net 7? Looks I can use it in a net6 project with setting the LangVersion to preview. I am a bit confused between the .net version feature and the c# language version feature.

williamliu
Автор

Not neccessarily related to raw string literals, but if the "level" string contains a quotation character ( " ) how do you properly encode it? (some helper function?)

theMagos
Автор

I think it's just too messy to work with. Whatever the situation I may find myself thinking of working with it I'll definitely try another solution... Hahaha.

jhonatanjacinto
Автор

Great Video, but I think I porefer the old way.

micro
Автор

What a confusing way to do simple string manipulation.

Gabeyre