本文整理汇总了C#中Common.List.SingleOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# List.SingleOrDefault方法的具体用法?C# List.SingleOrDefault怎么用?C# List.SingleOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common.List
的用法示例。
在下文中一共展示了List.SingleOrDefault方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindComboBox
void BindComboBox()
{
List<IModelObject> m_objList = codeMasterBL.SearchRecords(new CodeMaster_cmt_Info()
{
cmt_cKey1 = DefineConstantValue.CodeMasterDefine.KEY1_TYPEVALUE,
cmt_cKey2 = DefineConstantValue.CodeMasterDefine.KEY2_MATERIALTYPE
});
if (m_objList != null)
{
_TypeList = new List<CodeMaster_cmt_Info>();
// _TypeList.Add(new CodeMaster_cmt_Info() { cmt_cValue = "", cmt_cRemark = "" });
List<ComboBoxItem> cbis = new List<ComboBoxItem>();
ComboBoxItem cbi = new ComboBoxItem("", "");
cbis.Add(cbi);
foreach (IModelObject item in m_objList)
{
_TypeList.Add(item as CodeMaster_cmt_Info);
var nitem = item as CodeMaster_cmt_Info;
if (cbis.SingleOrDefault(d => d.Value.ToString() == nitem.cmt_cValue) == null)
{
cbis.Add(new ComboBoxItem(nitem.cmt_cRemark, nitem.cmt_cValue));
}
}
// cbType.ValueMember = "cmt_cValue";
// cbType.DisplayMember = "cmt_cRemark";
// cbType.DataSource = _TypeList;
cbType.DataSource = cbis;
}
m_objList = _MaterialMasterBll.SearchRecords_SQL(new MaterialProfile_mlpf_Info());
if (m_objList != null)
{
_BrandList = new List<MaterialProfile_mlpf_Info>();
_BrandList.Add(new MaterialProfile_mlpf_Info() { mlpf_cMaterialBrand = "" });
List<ComboBoxItem> cbis = new List<ComboBoxItem>();
ComboBoxItem cbi = new ComboBoxItem("", "");
cbis.Add(cbi);
foreach (IModelObject item in m_objList)
{
var nitem = item as MaterialProfile_mlpf_Info;
_BrandList.Add(nitem);
if (cbis.SingleOrDefault(d => d.Text == nitem.mlpf_cMaterialBrand) == null)
{
cbis.Add(new ComboBoxItem(nitem.mlpf_cMaterialBrand, nitem.mlpf_cMaterialBrand));
}
}
//cbBrand.ValueMember = "mlpf_cMaterialBrand";
// cbBrand.DisplayMember = "mlpf_cMaterialBrand";
// cbBrand.DataSource = _BrandList;
cbBrand.DataSource = cbis;
}
m_objList = codeMasterBL.SearchRecords(new CodeMaster_cmt_Info()
{
cmt_cKey1 = DefineConstantValue.CodeMasterDefine.KEY1_TYPEVALUE,
cmt_cKey2 = DefineConstantValue.CodeMasterDefine.KEY2_MATERIALUNIT
});
if (m_objList != null)
{
_UnitList = new List<CodeMaster_cmt_Info>();
foreach (IModelObject item in m_objList)
{
_UnitList.Add(item as CodeMaster_cmt_Info);
}
}
}