Skip to content

Commit 2922a88

Browse files
Adding Entension methods for Metadata
1 parent c354600 commit 2922a88

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/SocketLabs/InjectionApi/SocketLabsExtensions.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,5 +397,31 @@ public static ICustomHeader Add(this IList<ICustomHeader> source, string name, s
397397
}
398398

399399
#endregion
400+
401+
402+
#region List of Metadata
403+
404+
/// <summary>
405+
/// Adds a new metadata header to an existing list of metadata headers.
406+
/// </summary>
407+
/// <param name="source">The existing list of metadata headers.</param>
408+
/// <param name="name">The name of the new metadata header.</param>
409+
/// <param name="value">The value for the new metadata header.</param>
410+
/// <returns>Instance of <see cref="IMetadata"/></returns>
411+
/// <example>
412+
/// <code>
413+
/// var metadata = new <![CDATA[ List<IMetadata> ]]>();
414+
/// metadata.Add("name1", "value1");
415+
/// metadata.Add("name2", "value2");
416+
/// </code>
417+
/// </example>
418+
public static IMetadata Add(this IList<IMetadata> source, string name, string value)
419+
{
420+
var metadata = new Metadata(name, value);
421+
source.Add(metadata);
422+
return metadata;
423+
}
424+
425+
#endregion
400426
}
401427
}

0 commit comments

Comments
 (0)