Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 4.0 在C语言中附加到列表#_C# 4.0 - Fatal编程技术网

C# 4.0 在C语言中附加到列表#

C# 4.0 在C语言中附加到列表#,c#-4.0,C# 4.0,我有一个表,它从中提取一个值,如果该列中有任何错误消息,我需要给出一个硬编码消息,说“error is found” 但是 是否有任何方法附加它,因为我们可以显示到现在为止的ErrorMessage,它总是被覆盖 <Notification> Hey Buddy you have a error in the BODY Hey Buddy you have a error in the HEADER</Notification> 嘿,伙计,你的身体有问题 嘿,伙

我有一个表,它从中提取一个值,如果该列中有任何错误消息,我需要给出一个硬编码消息,说“error is found”

但是

是否有任何方法附加它,因为我们可以显示到现在为止的ErrorMessage,它总是被覆盖

<Notification>
Hey Buddy you have a error in the BODY   
Hey Buddy you have a error in the HEADER</Notification>

嘿,伙计,你的身体有问题
嘿,伙计,你头上有个错误

我使用SQL查询通过拉取包含错误列表的列来实现。如果列有1行作为错误,则应使用datatable检索值。我使用linq查询数据表并将其添加到列表中。谢谢大家的帮助

现在还不清楚您想要的输出是什么。你能用一个具体的例子来说明吗?此外,请检查您的代码。例如,如果(dt!=null dt.Rows.Count>0)。我认为您在这两个地方都缺少一个
&
。缩进代码也不会有什么坏处。是的,你是对的,但你有这个想法。。它希望进入该循环,因为我的Datatable没有错误。
if(dt != null dt.Rows.Count > 0 )  // It want go inside 
if(Book.ErrorMessage!= null && Book.ErrorMessage.Count>0)
// Will go here
// As it is using the same Property ErrorMessage for to get the HEADER 
//Error.
<Notification>
Hey Buddy you have a error in the BODY   
Hey Buddy you have a error in the HEADER</Notification>