我有一个 List<Fill> items
这是Fill班级:
public class Fill
{
public string arret { get; set;}
public string ligneSens { get; set;}
}
Run Code Online (Sandbox Code Playgroud)
如何从使用字符串值名单中删除项目arret和ligneSens?
示例:
void OnDelete(object sender, EventArgs e, string arretName, string ligneSensName)
{
var aFill = new Fill
{
arret = arretName,
ligneSens = ligneSensName
};
items.Remove(aFill); //<--- this doesn't work
}
Run Code Online (Sandbox Code Playgroud)
对不起,我不知道怎么问这个帖子的标题.
什么是同步方法,什么是异步方法?同步和异步方法有什么区别?我什么时候必须使用同步或异步方法?我问这些问题是因为我不明白:
public async void ReadData(filepath)
{
CreateDoc("hello"); //<------ Why I can't do that ?
}
public void CreateDoc(string astring)
{
Debug.WriteLine(astring);
}
Run Code Online (Sandbox Code Playgroud)
为什么我不能这样做?:
public async void ReadData(filepath)
{
var BarreDroite = new string[] { "|" };
foreach (string tableArret in items.Split(BarreDroite, StringSplitOptions.RemoveEmptyEntries))
{
listeArret.Add(tableArret); //<---- Here appear the problem.
}
{
Run Code Online (Sandbox Code Playgroud)
我问这个问题是因为我在网上找不到明确的解释。
我有这个简单的if语句比较两个对象属性(字符串):
if(client.room == sender.room){ /*Doesn't work*/ }
Run Code Online (Sandbox Code Playgroud)
我很惊讶它们没有通过所以我调试:
console.log(client.room + " == " + sender.room);
Run Code Online (Sandbox Code Playgroud)
输出是正确的:
#General == #General
Run Code Online (Sandbox Code Playgroud)
所以我尝试了很多东西,但仍然无效......
然后我尝试了这个:
var clientRoom = client.room;
if(clientRoom == '#General'){ /*Work!*/ }
if(client.room == '#General'){ /*Work!*/ }
Run Code Online (Sandbox Code Playgroud)
但我仍然被卡住......我如何比较这两个对象属性,看看它们是否相等?