private async Task<List<T>> Ex_Event(string telNo)
{
SearchConditionData scd = new SearchConditionData { tel=telNo };
List<T> list = await RequestAsync<SearchConditionData, List<T>>(scd, Service.GetIncident);
historyList = ( ... ).Take(30).ToList();
return historyList;
}
Run Code Online (Sandbox Code Playgroud)
我做了一个返回 List<> 的方法。
但是我异步修改了它,然后我不能使用List.Count。
这是我的代码的一部分。
public delegate Task<List<IncidentListData>> HistoryEvent(string telNo);
public event HistoryEvent myHistoryEvent;
Run Code Online (Sandbox Code Playgroud)
返回类型是任务<>。我想检查任务中的计数列表。
if (myHistoryEvent(Tel).Count > 0)
Run Code Online (Sandbox Code Playgroud)
但它不起作用。而且我不能使用异步,因为我在接口中调用了 myHistoryEvent() public string this[string name](IDataErrorInfo)
如何检查任务中列表的数量??
.xaml
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="cbx_srchResOrg" HorizontalAlignment="Stretch" Style="{DynamicResource ComboBoxStyle}"
ItemsSource="{Binding InfoCombo}" SelectedIndex="0" DisplayMemberPath="Dis_name" SelectedValuePath="Hide_id" SelectedItem="{Binding SelectInfo}"/>
Run Code Online (Sandbox Code Playgroud)
这是我的源代码的一部分。为什么“SelectedIndex=0”不起作用?我想在第一次选择 [0] 值作为默认值,但它在运行时只是空框。除了它没有错误。我该如何解决?
我在LinQ使用LinQ.然后有一个错误.
"你不能改变'
System.Collections.Generic.IEnumerable<string>'到'string'."
这是我的代码.
var reList = (from temp in list
select new ListData
{
Id = temp._Id,
Nm = temp._Nm,
Type = (from ex in Types
where ex.ID == temp._type
select ex.Cd_Nm)
}).ToList();
return reList;
Run Code Online (Sandbox Code Playgroud)
只有一个值
(from ex in Types
where ex.ID == temp._type
select ex.Cd_Nm)
Run Code Online (Sandbox Code Playgroud)
ToString()正在工作,但不显示字符串值,只显示类型名称.
我该怎么用?我该怎么办?