我有List对象.我该如何处理清单?
例如,
List<User> usersCollection =new List<User>();
User user1 = new User();
User user2 = new User()
userCollection.Add(user1);
userCollection.Add(user2);
Run Code Online (Sandbox Code Playgroud)
如果我确定userCollection = null;会发生什么?
foreach(User user in userCollection)
{
user = null;
}
Run Code Online (Sandbox Code Playgroud)
哪一个最好?
我是新手,XML并尝试了以下但我得到了一个例外.有人能帮我吗?
例外是 This operation would create an incorrectly structured document
我的代码:
string strPath = Server.MapPath("sample.xml");
XDocument doc;
if (!System.IO.File.Exists(strPath))
{
doc = new XDocument(
new XElement("Employees",
new XElement("Employee",
new XAttribute("id", 1),
new XElement("EmpName", "XYZ"))),
new XElement("Departments",
new XElement("Department",
new XAttribute("id", 1),
new XElement("DeptName", "CS"))));
doc.Save(strPath);
}
Run Code Online (Sandbox Code Playgroud) 我想获得从给定日期开始一年内的总天数.假设用户给出了04-01-2011(MM-DD-YYYY)我想要找到剩余的剩余天数.这该怎么做..
大家好我需要所有这些可能的情况才有效
123
123.1
123.12
Run Code Online (Sandbox Code Playgroud)
我尝试了这个,^[0-9]*\.[0-9]{2}$ or ^[0-9]*\.[0-9][0-9]$但没有任何人可以帮助我
我的Listview如下
Header1 Header2 Header3
Item1 Item2 Item3
Item1 Item2 Item3
Item1 Item2 Item3
Run Code Online (Sandbox Code Playgroud)
我已经编写了一个代码来显示context menu点击,list view但它也显示在Context menu上面headers.我Context menu只需要在用户点击时显示Items,list view任何人都可以帮助我
这是我目前编写的代码
private void listView1_MouseClick(object sender, MouseEventArgs e)
{
contextMenuStrip1.Show(listView1, e.Location);
}
Run Code Online (Sandbox Code Playgroud) 我的查询是使用存储过程中的Select查询为单个变量分配多个行例如:我从Employee表声明@id int得到10个(比如1到10个)员工ID
select @id =EmpId from Employee
select @id
Run Code Online (Sandbox Code Playgroud)
这将返回10行(ieEmployee id,假设表中有10行)现在我的问题是我将如何在单个变量中获取所有行并逐个使用该员工ID来执行一些计算.
我有一个文本文件,其中包含以下类型项
wett45456,4556,45657,898
tyu5878,4566,7989,55565
Run Code Online (Sandbox Code Playgroud)
现在我在那个窗体上有一个窗口,我有一个组合框,现在我想要填充每个第一行的组合框 wett45456,tyu5878
谢谢
我想在验证摘要中显示验证摘要,而不是在invidual验证器中显示它们意味着我只想在验证摘要中显示错误我不想在任何验证中显示
我想从当前日期获得3个日期,或者如果用户输入日期,16/07/2011我希望显示此前3个日期
15/07/2011,14/07/2011,13/07/2011
我写了一个查询以乘以colums现在我想总结我得到的结果可以任何人给我一个想法
这就是我写的
select Rate,Qty,(Rate*Qty) as result
from tblName
我会得到结果,例如40 90现在我想总结这些结果
c# ×8
asp.net ×5
winforms ×2
.net ×1
combobox ×1
contextmenu ×1
dispose ×1
linq ×1
linq-to-xml ×1
list ×1
listview ×1
regex ×1
sql-server ×1
validation ×1