using System.Collections.Generic;
public static void Main()
var options1 = new GuiControlOptionsModel(
new Dictionary<string, object>
var options2 = new GuiControlOptionsModel(
new Dictionary<string, object>
{"key2", "value2-from2"},
{"key4", "value4-from2"},
var mergedOptions = MergeLayoutControlOptions(
foreach (var option in mergedOptions)
System.Console.WriteLine(
$"Key: {option.Key} | Value: {option.Value}"
private static GuiControlOptionsModel MergeLayoutControlOptions(
params IGuiControlOptions[] options
return new GuiControlOptionsModel(
options.SelectMany(x => x)
.ToDictionary(x => x.Key, y => y.Last().Value)
public interface IGuiControlOptions
: IDictionary<string, object>
public class GuiControlOptionsModel
: Dictionary<string, object>,
public GuiControlOptionsModel(
IDictionary<string, object> dictionary
) : base(dictionary ?? new Dictionary<string, object>())