src/Markdig/Renderers/Html/HtmlAttributes.cs
/// <summary>
/// Adds the specified property only if it does not already exist.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="value">The value.</param>
Adds the specified property only if it does not already exist.
Adds the specified property only if it does not already exist .
public void AddPropertyIfNotExist(string name, object? value)
        {
            if (name is null) ThrowHelper.ArgumentNullException_name();
            if (Properties is null)
            {
                Properties = new (4);
            }
            else
            {
                for (int i = 0; i < Properties.Count; i++)
                {
                    if (Properties[i].Key.Equals(name, StringComparison.Ordinal))
                    {
                        return;
                    }
                }
            }
            Properties.Add(new KeyValuePair<string, string?>(name, value is null ? null : Convert.ToString(value, CultureInfo.InvariantCulture)));
        }
public void AddPropertyIfNotExist ( string name , object ? value ) { if ( name is null ) ThrowHelper . ArgumentNullException_name ( ) ; if ( Properties is null ) { Properties = new ( 4 ) ; } else { for ( int i = 0 ; i < Properties . Count ; i ++ ) { if ( Properties [ i ] . Key . Equals ( name , StringComparison . Ordinal ) ) { return ; } } } Properties . Add ( new KeyValuePair < string , string ? > ( name , value is null ? null : Convert . ToString ( value , CultureInfo . InvariantCulture ) ) ) ; }
Adds the specified property only if it does not already exist.
Adds the specified property only if it does not already exist .
name
string
None
value
object?
None