Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it valid to use `<%= "{0}, {1}", arg1, arg2 %>` in place of `<%= string.Format("{0}, {1}", arg1, arg2) %>` in ASP.NET aspx pages

In my aspx pages I often use the following and it works fine:

<%= "{0}, {1}", arg1, arg2 %>

I use ReSharper for code analysis. I just upgraded for v6.1 to 7 and it is giving me the following two errors:

"Expression expected"

"Method '__ReSharper_Render' has 1 parameter(s) but is invoked with 3 argument(s)"

Is the syntax I use incorrect? I would prefer to continue using it as I find it quite elegant and compact. If it is correct (I think it should be as it works), any idea how to tell ReSharper to either ignore it or treat it as valid?

like image 797
Saurabh Avatar asked Apr 11 '13 10:04

Saurabh


1 Answers

Saurabh, you are using implementation details of ASP.NET. It's bad practice. Better to specify it explicitly:

<%= string.Format("{0}, {1}", arg1, arg2) %>
like image 70
derigel Avatar answered Sep 19 '22 07:09

derigel