我试过这个......
public ArrayList GetAllObjectAttributes()
{
List<Task> taskList = new List<Task>();
ArrayList allObjectAttributes = new ArrayList();
taskList.Add(Task.Factory.StartNew(() => { allObjectAttributes.Add(GetObjectAttributes(TreeViewAttrs.Folder));}));
taskList.Add(Task.Factory.StartNew(() => { allObjectAttributes.Add(GetObjectAttributes(TreeViewAttrs.XMLFile)); }));
taskList.Add(Task.Factory.StartNew(() => { allObjectAttributes.Add(GetObjectAttributes(TreeViewAttrs.TextFile)); }));
taskList.Add(Task.Factory.StartNew(() => { allObjectAttributes.Add(GetObjectAttributes(TreeViewAttrs.Parent)); }));
Task.WaitAll(taskList.ToArray());
return allObjectAttributes;
}
Run Code Online (Sandbox Code Playgroud)
还有这个...
public ArrayList GetAllObjectAttributes()
{
Thread[] threads = new Thread[4];
ArrayList allObjectAttributes = new ArrayList();
threads[0] = new Thread(() => allObjectAttributes.Add(GetObjectAttributes(TreeViewAttrs.Folder)));
threads[1] = new Thread(() => allObjectAttributes.Add(GetObjectAttributes(TreeViewAttrs.XMLFile)));
threads[2] = new Thread(() => allObjectAttributes.Add(GetObjectAttributes(TreeViewAttrs.TextFile)));
threads[3] = new Thread(() => allObjectAttributes.Add(GetObjectAttributes(TreeViewAttrs.Parent)));
foreach(Thread thread in …Run Code Online (Sandbox Code Playgroud) 我可以在ac#类库中执行此操作来处理在执行类库代码本身期间可能发生的异常吗?我是编写类库和异常处理的新手.请指教.
private void MethodName(String text)
{
try
{
..............
..............
..............
}
catch (Exception ex)
{
throw new Exception(ex.Message.ToString());
}
}
Run Code Online (Sandbox Code Playgroud)
我在google和stackoverflow中搜索过,但是没有找到任何文章我是否允许以这种方式处理类库中的异常,或者是否不建议这样做.但它的确有效.可能是一个愚蠢的问题,但我有这个疑问.
谢谢.
我必须编写一个查询来获取以下数据作为结果.我的数据库中有四列.ID不为null,其他所有ID都可以为null.
EMP_ID EMP_FIRST_NAME EMP_LAST_NAME EMP_PHONE
1 John Williams +123456789
2 Rodney +124568937
3 Jackson +124578963
4 Joyce Nancy
Run Code Online (Sandbox Code Playgroud)
现在我必须编写一个返回非空的列的查询.我不想在查询中指定列名.
我的意思是,我想使用SELECT * FROM TABLE WHERE- 并添加过滤器,但我不想在WHERE子句后指定列名.
这个问题可能是愚蠢的,但在必要时纠正我.我是SQL的新手,正在使用c#和sql开发一个项目.
为什么我不想使用列名,因为我有超过250列和1500行.现在,如果我选择任何行,则至少有一列将具有空值.我想选择行,但该特定行具有空值的列不应出现在结果中.
请指教.先感谢您.
此致,Vinay S.