AspNetEdit.Editor.Persistence.TagAttributes.Add C# (CSharp) Метод

Add() публичный Метод

public Add ( object key, object value ) : void
key object
value object
Результат void
        public void Add(object key, object value)
        {
            if (key != null && value != null &&
                0 == String.Compare ((string) key,  "runat", true)) {
                    if (0 != String.Compare ((string) value,  "server", true))
                    throw new HttpException ("runat attribute must have a 'server' value");

                if (got_hashed)
                    return; // ignore duplicate runat="server"

                MakeHash ();
            }

            if (value != null)
                value = HttpUtility.HtmlDecode (value.ToString ());

            if (got_hashed) {
                CheckServerKey (key);
                if (atts_hash.ContainsKey (key))
                    throw new HttpException ("Tag contains duplicated '" + key +
                                 "' attributes.");
                atts_hash.Add (key, value);
            } else {
                keys.Add (key);
                values.Add (value);
            }
        }

Usage Example

Пример #1
0
        TagAttributes GetAttributes()
        {
            int           token;
            TagAttributes attributes;
            string        id;

            attributes = new TagAttributes();
            while ((token = tokenizer.get_token()) != Token.EOF)
            {
                if (token == '<' && Eat('%'))
                {
                    tokenizer.Verbatim = true;
                    attributes.Add("", "<%" +
                                   GetVerbatim(tokenizer.get_token(), "%>") + "%>");
                    tokenizer.Verbatim = false;
                    tokenizer.InTag    = true;
                    continue;
                }

                if (token != Token.IDENTIFIER)
                {
                    break;
                }

                id = tokenizer.Value;
                if (Eat('='))
                {
                    if (Eat(Token.ATTVALUE))
                    {
                        attributes.Add(id, tokenizer.Value);
                    }
                    else if (Eat('<') && Eat('%'))
                    {
                        tokenizer.Verbatim = true;
                        attributes.Add(id, "<%" +
                                       GetVerbatim(tokenizer.get_token(), "%>") + "%>");
                        tokenizer.Verbatim = false;
                        tokenizer.InTag    = true;
                    }
                    else
                    {
                        OnError("expected ATTVALUE");
                        return(null);
                    }
                }
                else
                {
                    attributes.Add(id, null);
                }
            }

            tokenizer.put_back();
            return(attributes);
        }
All Usage Examples Of AspNetEdit.Editor.Persistence.TagAttributes::Add