随笔 - 16  文章 - 0  评论 - 4 
  2008年7月8日

What does it mean that a method is static?

A static method is simply one that is disassociated from any instance of its containing class. The more common alternative is an instance method, which is a method whose result is dependent on the state of a particular instance of the class it belongs to.

For example, both of these statements would return precisely the same string, but accomplish it through different types of methods:

// ToString() is an instance method of the DateTime class.
//  Its result depends on the value of each DateTime instance.
return DateTime.Now.ToString();
 
// String.Format is a static method of the String class.
//  Its result is not related to any instance of the String.
return String.Format("{0}", DateTime.Now);

The key difference to understand is that a static method can be called without setting up a proper instance of the class it belongs to.

In a sense, it is a stateless method.

posted @ 2008-07-08 04:20 one 阅读(8) | 评论 (0)编辑

The final advantage of using const over readonly is performance: Known
constant values can generate slightly more efficient code than the variable
accesses necessary for readonly values. However, any gains are slight and
should be weighed against the decreased flexibility.
Be sure to profile
performance differences before giving up the flexibility.


const must be used when the value must be available at compile times:
attribute parameters and enum definitions, and those rare times when
you mean to define a value that does not change from release to release.
For everything else, prefer the increased flexibility of readonly constants.

posted @ 2008-07-08 04:08 one 阅读(8) | 评论 (0)编辑
  2008年6月30日
1)More and more people use the mobile phone or computer to communicate, and no longer write letters to each other. Some people think the skills of letter writing will soon disappear completely. Do you agree or disagree? How important do you think letter-writing is?

2)It is now possible to perform everyday tasks as banking, shopping and business transactions without meeting people face-to-face. What are the effects it may bring on the individual and the society as a whole? 

)Nowadays, a lot of advertisements are aimed at children. Some people think there are lots of negative effects for children and should ban the advertisements. To what extent do you agree or disagree?

4)Some think the government should be responsible for ensuring the people of the country that have healthy lifestyles. Others think we should make our own living decisions. Discuss both opinions and give your opinion.
posted @ 2008-06-30 02:52 one 阅读(14) | 评论 (0)编辑
  2008年6月5日

积极方面  

1. give students/ citizens motivation to…给学生/公民动力去……
2. narrow the gap between the wealthy and the impoverished 减少贫富差距
3. curb crimes 控制犯罪
4. allocate money to投资于…
5. promote the development of… 促进…的发展
6. It is obvious that…显而易见,…
7. play a key role in 起关键作用  
8. enhance the efficiency of…提高效率
9. enrich one’s experience …丰富某人的经验
10. keep society safe and stable 保持社会稳定
11. have an obligation to do …有责任去…
12. afford people entertainment and pleasure 给人们提供娱乐
13. create employment opportunities   创造就业机会
14. put something in the first place = give priority to… 把…当成首要任务
15. is less time-consuming and more economical 省钱又省时间
16. broaden one’s horizons 开阔人的眼界
17. contribute to … 为…作贡献
18. fulfill one's potential 发挥......的潜力

消极方面

19. live a stressful life生活压力大
20. the competition is stiff 竞争激烈
21. impair people’s health 破坏人的健康
22. the population is booming 人口爆炸
23. restrict the development of 限制……的发展
24. lower the efficiency of… 降低……的效率
25. stem from 某事由…导致
26. suffer from 遭受
27. is a threat to… 对…构成威胁
28. have detrimental influence upon  对…产生有害的影响
29. cope with  解决,处理
30. take measures to … 采取措施…
31. There is a definite link between A and B     A和B之间有密切的联系
32. is increasingly severe 越来越严重
33. is monotonous 单调的
34. create psychological problems 产生心理问题

posted @ 2008-06-05 08:42 one 阅读(10) | 评论 (0)编辑
  2008年4月18日

最近同事小朱受到减少代码的影响,在非正常状态下写下的代码:

1.构造函数给类的Property创造实例。
正常版:
 public class Parameters
    
{
        
public Parameters()
        
{
            Server 
= new KeyValue();
        
        }

       
        
public KeyValue Server getset; }
     }
无奈版:
1 public Parameters()
2        {
3            foreach (PropertyInfo pi in this.GetType().GetProperties())
4            {
5                pi.SetValue(this, Activator.CreateInstance(pi.PropertyType), null);
6            }

7        }
posted @ 2008-04-18 09:42 one 阅读(16) | 评论 (0)编辑
  2008年3月26日

将List<T>转换为BindingList<T>,然后设置DataGridView的DataSource为BindingList<T>!!
代码:

DataGridView.DataSource = new BindingList<T>(List<T>);

将绑定BindingList<T>的DataSource转化为List<T>,同理
代码:
List<T> modelList=new List<T>((BindingList<T>)this.DataGridView.DataSource);


说明:BindingList<T>和List<T>都有个构造函数,参数是IEnumerable<T>,既然他们俩个都是继承IEnumerable,当然能相互转换。

下面是这个构造函数的执行过程:

public List(IEnumerable<T> collection)
{
    
if (collection == null)
    
{
        ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection);
    }

    ICollection
<T> is2 = collection as ICollection<T>;
    
if (is2 != null)
    
{
        
int count = is2.Count;
        
this._items = new T[count];
        is2.CopyTo(
this._items, 0);
        
this._size = count;
    }

    
else
    
{
        
this._size = 0;
        
this._items = new T[4];
        
using (IEnumerator<T> enumerator = collection.GetEnumerator())
        
{
            
while (enumerator.MoveNext())
            
{
                
this.Add(enumerator.Current);
            }

        }

    }

}


posted @ 2008-03-26 06:50 one 阅读(244) | 评论 (4)编辑

Advantage: benefit, positive aspect, strength, 好处

Disadvantage: weakness, drawback, negative aspect, fault不利

Casual: arbitrary, unplanned, unexpected, 随意的

Effective: efficient, effectual, fruitful, productive, valid多效的

Criticize: reproach, blame, 批评

Flaw: weakness, defect 缺点

Ability; capability, power, caliber能力

Dishonest: deceptive 不诚实的

Fair: equitable, equal, impartial, 公平的

Success: achievement, feat 成功

Reason: factor, contributor, origin, 原因

Result: outcome, consequence, implication结果

Result from: arise from, originate from, be due to, thanks to, 由于,因为

Give rise to: contribute to, lead to, result in, cause, breed, create, incur导致

Disaster: catastrophe 灾难

Pollute: contaminate 污染

Poisonous: toxic 有毒的

Decrease; fall, drop, plunge, decline, step back, downward, minimize, abate下降

Increase: rise, go up, surge, grow, 上升

Growing: increasing, rising, 上升的

posted @ 2008-03-26 06:28 one 阅读(24) | 评论 (0)编辑
  2008年3月25日
posted @ 2008-03-25 12:47 one 阅读(10) | 评论 (0)编辑
.dude(老兄,老哥)

很多人认为该词单指“花花公子,纨绔子弟”的意思,实际上此词是叫男性年轻人的常用词,与guy的意思相同,只是guy用的范围更广。 例子:Hey dude look at that girl.(喂,老兄,看那个女孩)

2.chick(女孩)

容易被误解为“鸡,妓女”,实际上此词是叫女孩的常用词,语气中确实有轻佻、不尊重的倾向。例子:Look at that chick at the door.(看门口的那个女孩)

3.pissed off(生气,不高兴)

千万别认为是“尿尿”的意思,piss off在字典中则是“滚开,滚蛋”的意思,实际上此词是表示“生气,不高兴”的意思,与angry同意。例子:Man,is that guy pissed of ?(哎呀,那家伙真的生气了)

4.Hey,Give me five(嗨,好啊!)

此短语非常流行,经常在大片中出现,常在击掌庆贺时用。例子:Hey,dude! Give me five!(嗨,老兄,好啊!)

5.freak out(大发脾气)

总是在片子中看到这个词,freak本义是“奇异的,反常的”的意思,但freak out是“大发脾气”的意思,out也可以省略,这个词在美语中很常见,老式说法是be very upset。例子:He’s gonna freak(他快要发脾气了)

6.Get out of here(别开玩笑了,别骗人了)

大家很容易联想到“滚开”的意思,其实,现在很多时候都用在“别开玩笑了,别骗人了”的意思里,在美国片子中常可以听到。例子:(Man:)You look very beautiful(你很漂亮)(Girl)Get out of here.(别骗了)

7.gross(真恶心)

此词不是“混乱”的意思,字典中gross是“总的,毛重的”的意思,实际上此词是表示“恶心”的意思与gag相近,是美国年轻人一天到晚挂在嘴边的词。例子:Yuck, what is this stuff?It looks gross.(哎呀,这是什么东西?真恶心)

8.Hello(有没有搞错)

并不总是打招呼的意思,有时是“有没有搞错”的意思,要根据上下文来判断。 例子:Hello,anybody home,we’ll be late!(有没有搞错, 我们要迟到了)

9.green(新手,没有经验)

不是“绿色”的意思,也不是“生气”的意思,有时表示“新手,没有经验”。例子:She’s really green,she looks nervous.(她是新手,看起来很紧张)

10.Have a crush on someone(爱上某人)

由于crush是“压碎,碾碎”的意思,因此整个短语容易被误解为“对某人施加压力”的意思, 实际上此词表示“爱上某人”,与fall in love with 同意。例子:She thinks she has a crush on John.(她认为她爱上约翰了)

posted @ 2008-03-25 10:08 one 阅读(10) | 评论 (0)编辑

borrow 借进   
lend 借出   
organize the loan 借书   
out of loan 已借出   
available 可借到   
loan period 借期   
renew 续借   
circulate 借还   
circulation desk 借还书处   
information desk 问询处   
restrict 限制   
demagnetise 消磁   
reserve 保管   
works 著作   
newspaper 报纸   
magazine 杂志   
journal/periodical/current issues 期刊   
catalogue 目录   
category 分类   
librarian 图书馆管理员   
due 到期   
overdue 过期   
pay a fine 罚款   
stacks 书库   
open/closed shelves 开/闭架   
extension 图书馆扩建工程   
call slip 索书单 

posted @ 2008-03-25 10:02 one 阅读(11) | 评论 (0)编辑