111,129
社区成员
发帖
与我相关
我的任务
分享 private U myconvert<T,U>(T obj,Func<T,U> func)
{
return func(obj);
} string str=myconvert(1, c => c.ToString());//int2string
int rint = myconvert("1", c => Convert.ToInt32(c));//string2int
public T GetCopyData<T>(T t1) where T : ICloneable
{
return (T)t1.Clone();
} // 摘要:
// 封装一个具有一个参数并返回 TResult 参数指定的类型值的方法。
//
// 参数:
// arg:
// 此委托封装的方法的参数。
//
// 类型参数:
// T:
// 此委托封装的方法的参数类型。
//
// TResult:
// 此委托封装的方法的返回值类型。
//
// 返回结果:
// 此委托封装的方法的返回值。
[TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
public delegate TResult Func<in T, out TResult>(T arg);