1、引入迭代器 记得以前经常做到一些面试题,是关于要实现迭代器必须实现什么接口?其实,在C# 
1.0里我们就经常用到foreach了,所以,只要支持foreach,那么这个类型就可以使用foreach 去遍历。那如何才能支持foreach 呢? 
其实,答案都知道,要实现IEnumerable ...
                            
                            
                                分类:
其他好文   时间:
2014-05-27 02:47:43   
                                阅读次数:
277
                             
                    
                        
                            
                            
                                string tempSFZH = ""; foreach (DataRow rs in 
ds.Tables[0].Rows) { tempSFZH = rs[ht["身份证号码"].ToString()].ToStri...
                            
                            
                                分类:
其他好文   时间:
2014-05-23 11:47:29   
                                阅读次数:
204
                             
                    
                        
                            
                            
                                public static class Extensions{public static 
async Task ForEachAsync(this IEnumerable collection, Func> body, IObserver 
observer = null){foreach (var ...
                            
                            
                                分类:
其他好文   时间:
2014-05-23 10:55:36   
                                阅读次数:
213
                             
                    
                        
                            
                            
                                如下参考实例: TimeSpan ts= new TimeSpan(0); TimeSpan 
ts2 = new TimeSpan(0); foreach (var item in alarmListOfSpecifyOrg) { if 
(_graphicsManager.ExistsAlarm.....
                            
                            
                                分类:
其他好文   时间:
2014-05-23 03:23:49   
                                阅读次数:
239
                             
                    
                        
                            
                            
                                Cancellation tokenParallel 
optionsCancellationTokenSource cancellationTokenSource = new 
CancellationTokenSource();Task.Factory.StartNew(() =>{ Thre...
                            
                            
                                分类:
Web程序   时间:
2014-05-22 16:43:14   
                                阅读次数:
332
                             
                    
                        
                            
                            
                                for (int i = 0; i SteppedIntegerList(int 
startIndex, int endEndex, int stepSize){ for (int i = startIndex; i { 
Console.WriteLine...
                            
                            
                                分类:
Web程序   时间:
2014-05-22 16:08:30   
                                阅读次数:
281
                             
                    
                        
                            
                            
                                List integers = new List() { 0, 1, 2, 3, 4, 5, 
6, 7, 8, 9 };Parallel.ForEach(integers, (int item, ParallelLoopState state) 
=>{ if (item > 5) { ...
                            
                            
                                分类:
Web程序   时间:
2014-05-22 16:03:56   
                                阅读次数:
287
                             
                    
                        
                            
                            
                                题目链接:uva 10253 - Series-Parallel Networks
题目大意:就是有n条线,通过并联或者是串联,形成一个整体,问说有n条线,可以组成多少种。
解题思路:大白书上的例题,解法还真是高端.dp[i][j]表示说每个树德叶子节点不大于i,一共有j个叶子。f[i]=dp[i-1][i],注意n为1的时候。
#include 
#include 
typede...
                            
                            
                                分类:
Web程序   时间:
2014-05-22 11:03:40   
                                阅读次数:
402
                             
                    
                        
                            
                            
                                var ent = new Ent(); foreach (var item in 
ent.GetType().GetProperties()) { var v = (DescriptionAttribute[])item...
                            
                            
                                分类:
其他好文   时间:
2014-05-22 04:41:40   
                                阅读次数:
324
                             
                    
                        
                            
                            
                                $rainbowdash);
  $postvars = ''; 
  foreach($fields as $key=>$value) {
    $postvars .= $key . $value;
  }
  $ur...
                            
                            
                                分类:
Web程序   时间:
2014-05-21 16:49:44   
                                阅读次数:
357