Escaping single quote in String.Format()

后端 未结 3 2071
醉酒成梦
醉酒成梦 2020-12-15 04:10

I have been all over the \'tubes and I can\'t figure this one out. Might be simple.

The following String.Format call:

return dt.ToString         


        
3条回答
  •  再見小時候
    2020-12-15 04:36

    I don't like the C# @ strings unless I really have to use them so I would actually go with this.

    return dt.ToString("MMM d \\'yy 'at' H:mmm");
    

    It's just a preference though for which you find easier to "read".

提交回复
热议问题