System.Web.Mvc.CacheContent.JavascriptInclude C# (CSharp) Method

JavascriptInclude() public static method

Renders a Javascript script include tag and appends the assembly's hash code as a querystring to the file to ensure users load the latest code file when the code is updated.
public static JavascriptInclude ( this html, Type type ) : System.Web.Mvc.MvcHtmlString
html this
type Type Pass a type so we can make a hash of its assembly. This should be a class in your web project.
return System.Web.Mvc.MvcHtmlString
        public static MvcHtmlString JavascriptInclude(this HtmlHelper html, Type type, params string[] urls)
        {
            var sb = new StringBuilder();
            var hash = type.Assembly.GetHashCode();
            foreach (string url in urls)
                sb.AppendLine(string.Format("<script language=\"javascript\" type=\"text/javascript\" src=\"{0}?v={1}\"></script>",
                    url, hash));
            return MvcHtmlString.Create(sb.ToString());
        }