Contains a simple string, with the owning extension name added as an additional property.
Пример #1
0
        /// <summary>
        /// Adds the link with the specified name and URL (pattern).
        /// </summary>
        /// <param name="linkName">The name of the link.</param>
        /// <param name="linkUrl">The URL (pattern) of the link.</param>
        internal ExtensionString AddLink(string linkName, string linkUrl)
        {
            Contract.Requires<ArgumentNullException>(!string.IsNullOrWhiteSpace(linkName));
            Contract.Requires<ArgumentNullException>(!string.IsNullOrWhiteSpace(linkUrl));

            if (linkUrl.StartsWith("~/"))
                linkUrl = linkUrl.Replace("~/", applicationPath.TrimEnd('/') + "/");

            if (!linkUrl.StartsWith("/") && !linkUrl.Contains("://"))
                linkUrl = string.Concat(applicationPath.TrimEnd('/'), "/", linkUrl);

            ExtensionString result = new ExtensionString(linkUrl);
            links[linkName] = result;
            return result;
        }
Пример #2
0
        /// <summary>
        /// Adds the specified key and value to the dictionary.
        /// </summary>
        /// <param name="formatName">The name of the format pattern.</param>
        /// <param name="formatValue">The format pattern.</param>
        internal ExtensionString AddFormat(string formatName, string formatValue)
        {
            Contract.Requires<ArgumentNullException>(!string.IsNullOrWhiteSpace(formatName));
            Contract.Requires<ArgumentNullException>(!string.IsNullOrWhiteSpace(formatValue));

            ExtensionString result = new ExtensionString(formatValue);
            formats[formatName] = result;
            return result;
        }