最佳答案
我想创建一个通用函数来执行一些操作,比如:
ConvertValue<T>(string value)
如果 T是 int,那么函数将把值转换为 int并返回结果。
类似地,如果 T是 boolean,函数将把 value转换为 boolean并返回它。
怎么写?