| 
 
积分40186好友记录主题帖子听众收听 
 | 
 
| [深圳]澄泓9:49:00 深圳-柠檬9:49:16复制代码out关键字的意思是说IEnumerable< T>中T只会被用在输出中,值不会被改变。这样将IEnumerable< string>转为IEnumerable< object>类型就是安全的。
    in的意思正好相反,是说IComparer< T>中的T只会被用在输入中,这样就可以将IComparer< object>安全的转为IComparer< string>类型。
 michael9:49:19
 in 代表是参数,out就代码返回值
 [深圳]澄泓9:49:33
 还没有这样用过
 [重庆]版主-Eagle9:49:36
 out put
 龙冀平9:49:58
 呵呵,现在主群比较强大啊
 人多才好交流
 [重庆]版主-Eagle9:50:45
 in 还真没这样用过!
 
 一般都是设定类型
 michael9:51:15
 这个是4里的特性吧..
 &叮咚9:51:26
 [深圳]澄泓9:51:29复制代码public interface IComparable < in T>
{
     int CompareTo(T other);
}
public interface IComparable <  T>
{
     int CompareTo(T other);
}
嗯
 michael9:51:34
 用于泛型的..
 &叮咚9:51:52
 有区别么复制代码public interface IComparable < in T>
{
     int CompareTo(T other);
}
public interface IComparable <  T>
{
     int CompareTo(T other);
}
michael9:52:00
 没有..
 &叮咚9:52:13
 哦
 michael9:52:14
 in是相对于out来说的..
 michael9:52:21
 有out才会有in
 &叮咚9:52:22
 感觉有点迷糊
 [深圳]澄泓9:53:37
 谁搞一篇弄到论坛
 michael:54:28
 这个有什么迷糊的啊..
 [深圳]澄泓9:54:50
 没用过
 michael9:55:01
 如果迷糊,那你的基础还是差了点..
 [石家庄]123456 9:55:10
 怎么回事
 michael9:55:10
 这个问题先放放吧..
 &叮咚9:55:18
 你真牛
 [深圳]澄泓9:55:40
 [code=csharp]System.Func< in T, …, out R>  System.Action< in T, …>  System.Predicate< in T>  System.Comparison< in T>  System.EventHandler< in T> [/code]
 [深圳]澄泓 9:55:53
 这玩意都没有用过
 [石家庄]123456 9:56:12
 牛人呀
 [厦门]龙冀平9:56:27
 膜拜
 
 | 
 |