GetContentsAsString() public static méthode

Loads the contents of an embedded static file and converts it to a string.
public static GetContentsAsString ( string name ) : string
name string The name of the file to load.
Résultat string
Exemple #1
0
        /// <summary>
        /// Gets the templates HTML as a string.
        /// </summary>
        /// <returns>The templates HTML as a string.</returns>
        private static string GetTemplatesHtml()
        {
            const string Key       = "BlueCollar.Dashboard.Index.Templates";
            string       templates = HttpRuntime.Cache[Key] as string;

            if (string.IsNullOrEmpty(templates))
            {
                templates = StaticFile.GetContentsAsString("BlueCollar.Dashboard.Static.templates.html");

                HttpRuntime.Cache.Add(
                    Key,
                    templates,
                    null,
                    Cache.NoAbsoluteExpiration,
                    Cache.NoSlidingExpiration,
                    CacheItemPriority.Normal,
                    null);
            }

            return(templates);
        }