I want to use C# string array in JS plugin with razor syntax.
C# Code:(in cshtml)
@{ string[] extentions = new string[] { "jpg", "png", "gif", "jpeg", "pdf" }; }
JS Code :
$('#file').filer({ limit: 2, maxSize: 4000, extensions: ["jpg", "png", "gif", "jpeg", "pdf"], ... })
JS Code with C# string[]:
$('#file').filer({ limit: 2, maxSize: 4000, extensions: '@extentions', ... })
In this case I get System.String[]
and if I use JsonConvert.SerializeObject(extentions)
I get something like this:
["jpg","png","gif","jpeg","pdf"]
What is the best way convert c# string array to Js array in the format that I want?