本文整理汇总了C#中IDictionary.Merge方法的典型用法代码示例。如果您正苦于以下问题:C# IDictionary.Merge方法的具体用法?C# IDictionary.Merge怎么用?C# IDictionary.Merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDictionary
的用法示例。
在下文中一共展示了IDictionary.Merge方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckBox
public static MvcHtmlString CheckBox(
this HtmlHelper htmlHelper,
string name,
bool isChecked,
Property property,
IDictionary<string, object> htmlAttributes)
{
var validationAttributes = PropertyUnobtrusiveValidationAttributesGenerator
.GetValidationAttributes(property, htmlHelper.ViewContext);
htmlAttributes = htmlAttributes.Merge(validationAttributes);
return htmlHelper.CheckBox(name, isChecked, htmlAttributes);
}
示例2: Password
public static MvcHtmlString Password(
this HtmlHelper htmlHelper,
string name,
object value,
Property property,
IDictionary<string, object> htmlAttributes)
{
var validationAttributes = PropertyUnobtrusiveValidationAttributesGenerator
.GetValidationAttributes(property, htmlHelper.ViewContext);
htmlAttributes = htmlAttributes.Merge(validationAttributes);
return htmlHelper.Password(name, value, htmlAttributes);
}
示例3: DropDownList
public static MvcHtmlString DropDownList(
this HtmlHelper htmlHelper,
string name,
IEnumerable<SelectListItem> selectList,
Property property,
IDictionary<string, object> htmlAttributes)
{
var validationAttributes = PropertyUnobtrusiveValidationAttributesGenerator
.GetValidationAttributes(property, htmlHelper.ViewContext);
htmlAttributes = htmlAttributes.Merge(validationAttributes);
return htmlHelper.DropDownList(name, selectList, htmlAttributes);
}
示例4: TextArea
public static MvcHtmlString TextArea(
this HtmlHelper htmlHelper,
string name,
string value,
Property property,
IDictionary<string, object> htmlAttributes)
{
// create own metadata based on PropertyViewModel
var metadata = new ModelMetadata(
ModelMetadataProviders.Current,
property.Entity.Type,
null,
property.TypeInfo.Type,
property.Name);
var validationAttributes =
htmlHelper.GetUnobtrusiveValidationAttributes(name, metadata);
htmlAttributes = htmlAttributes.Merge(validationAttributes);
return htmlHelper.TextArea(name, value, htmlAttributes);
}
示例5: DropDownList
public static MvcHtmlString DropDownList(
this HtmlHelper htmlHelper,
string name,
IEnumerable<SelectListItem> selectList,
Property property,
IDictionary<string, object> htmlAttributes)
{
// create own metadata based on PropertyViewModel
var metadata = new ModelMetadata(
ModelMetadataProviders.Current,
property.Entity.Type,
null,
property.TypeInfo.Type,
property.Name);
var validationAttributes =
htmlHelper.GetUnobtrusiveValidationAttributes(name, metadata);
htmlAttributes = htmlAttributes.Merge(validationAttributes);
return htmlHelper.DropDownList(name, selectList, htmlAttributes);
}
示例6: GetDataFields
private IDictionary<string, string> GetDataFields(NancyContext context)
{
var dictionaries = new IDictionary<string, string>[]
{
ConvertDynamicDictionary(context.Request.Form),
ConvertDynamicDictionary(context.Request.Query),
ConvertDynamicDictionary(context.Parameters)
};
return dictionaries.Merge();
}
示例7: LoadInclude
private bool LoadInclude(XmlNode node, IDictionary<string, string> defines)
{
if (node == null || Children == null)
{
return false;
}
try
{
XmlDocument doc = new XmlDocument();
doc.Load(GUIGraphicsContext.GetThemedSkinFile("\\" + node.InnerText));
if (doc.DocumentElement == null)
{
return false;
}
// Load #defines specified in the included skin xml document and add them to the existing (parent document) set of #defines.
// The dictionary merge replaces the value of duplicates.
IDictionary<string, string> includeDefines = LoadDefines(doc);
defines = defines.Merge(includeDefines);
if (doc.DocumentElement.Name != "window")
{
return false;
}
var xmlNodeList = doc.DocumentElement.SelectNodes("/window/controls/control");
if (xmlNodeList != null)
foreach (XmlNode controlNode in xmlNodeList)
{
LoadControl(controlNode, defines);
}
return true;
}
catch (FileNotFoundException e)
{
Log.Error("SKIN: Missing {0}", e.FileName);
return false;
}
catch (Exception e)
{
Log.Error("GUIWIndow.LoadInclude: {0}", e.Message);
}
return false;
}
示例8: Serialize
protected override void Serialize(IDictionary<string, object> json)
{
if (Transport.Read.Url == null)
{
// If Url is not set assume the current url (used in server binding)
Transport.Read.Url = "";
}
var transport = Transport.ToJson();
if (transport.Keys.Any())
{
json["transport"] = transport;
}
if (PageSize > 0)
{
json["pageSize"] = PageSize;
json["page"] = Page;
json["total"] = Total;
}
if (ServerPaging)
{
json["serverPaging"] = ServerPaging;
}
if (ServerSorting)
{
json["serverSorting"] = ServerSorting;
}
if (ServerFiltering)
{
json["serverFiltering"] = ServerFiltering;
}
if (ServerGrouping)
{
json["serverGrouping"] = ServerGrouping;
}
if (ServerAggregates)
{
json["serverAggregates"] = ServerAggregates;
}
if (Type != null)
{
json["type"] = "aspnetmvc-" + Type.ToString().ToLower();
}
if (OrderBy.Any())
{
json["sort"] = OrderBy.ToJson();
}
if (Groups.Any())
{
json["group"] = Groups.ToJson();
}
if (Aggregates.Any())
{
json["aggregate"] = Aggregates.SelectMany(agg => agg.Aggregates.ToJson());
}
if (Filters.Any() || ServerFiltering)
{
json["filter"] = Filters.OfType<FilterDescriptorBase>().ToJson();
}
if (Events.Keys.Any())
{
json.Merge(Events);
}
json["schema"] = Schema.ToJson();
if (Batch)
{
json["batch"] = Batch;
}
if (IsClientOperationMode && RawData != null)
{
json["data"] = new Dictionary<string, object>()
{
{ Schema.Data, SerializeDataSource(RawData) },
{ Schema.Total, Total }
};
}
else if (Type == DataSourceType.Ajax && !IsClientOperationMode && Data != null)
{
json["data"] = new Dictionary<string, object>()
{
{ Schema.Data, SerializeDataSource(Data) },
{ Schema.Total, Total }
};
}
//.........这里部分代码省略.........
示例9: Serialize
//.........这里部分代码省略.........
}
}
if (!string.IsNullOrEmpty(OfflineStorageKey))
{
json["offlineStorage"] = OfflineStorageKey;
}
if (OfflineStorage.Any())
{
json["offlineStorage"] = OfflineStorage;
}
if (PageSize > 0)
{
json["pageSize"] = PageSize;
json["page"] = Page;
json["total"] = Total;
}
if (ServerPaging)
{
json["serverPaging"] = ServerPaging;
}
if (ServerSorting)
{
json["serverSorting"] = ServerSorting;
}
if (ServerFiltering)
{
json["serverFiltering"] = ServerFiltering;
}
if (ServerGrouping)
{
json["serverGrouping"] = ServerGrouping;
}
if (ServerAggregates)
{
json["serverAggregates"] = ServerAggregates;
}
if (OrderBy.Any())
{
json["sort"] = OrderBy.ToJson();
}
if (Groups.Any())
{
json["group"] = Groups.ToJson();
}
if (Aggregates.Any())
{
json["aggregate"] = Aggregates.SelectMany(agg => agg.Aggregates.ToJson());
}
if (Filters.Any() || ServerFiltering)
{
json["filter"] = Filters.OfType<FilterDescriptorBase>().ToJson();
}
if (Events.Keys.Any())
{
json.Merge(Events);
}
var schema = Schema.ToJson();
if (schema.Keys.Any())
{
json["schema"] = schema;
}
if (Batch)
{
json["batch"] = Batch;
}
if (AutoSync)
{
json["autoSync"] = AutoSync;
}
if (IsClientOperationMode && Type == DataSourceType.Custom && CustomType != "aspnetmvc-ajax")
{
RawData = Data;
}
if (IsClientOperationMode && RawData != null)
{
SerializeData(json, RawData);
}
else if (IsClientBinding && !IsClientOperationMode && Data != null)
{
SerializeData(json, Data);
}
}