C#??????У?С??????
???????????? ???????[ 2016/3/4 10:58:52 ] ????????.NET ???????????
????3???????????
??????1?????????????????????????????÷???????????????????????Щstatic????÷???????????????????????????DataGridViewRow????????????????Model????????£?
public static T ToObject<T>(DataGridViewRow item) where T:class
{
var model = item.DataBoundItem as T;
if (model != null)
return model;
var dr = item.DataBoundItem as System.Data.DataRowView;
model = (T)typeof(T).GetConstructor(new System.Type[] { }).Invoke(new object[] { });
//????????????????
PropertyInfo[] pro = typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public);
Type type = model.GetType();
foreach (PropertyInfo propertyInfo in pro)
{
if (Convert.IsDBNull(dr[propertyInfo.Name]))
{
continue;
}
if (!string.IsNullOrEmpty(Convert.ToString(dr[propertyInfo.Name])))
{
var propertytype = propertyInfo.PropertyType;
if (propertytype == typeof(System.Nullable<DateTime>) || propertytype == typeof(DateTime))
{
type.GetProperty(propertyInfo.Name).SetValue(model?? Convert.ToDateTime(dr[propertyInfo.Name])?? null);
}
else if (propertytype == typeof(System.Nullable<decimal>) || propertytype == typeof(decimal))
{
type.GetProperty(propertyInfo.Name).SetValue(model?? Convert.ToDecimal(dr[propertyInfo.Name])?? null);
}
else if (propertytype == typeof(System.Nullable<int>) || propertytype == typeof(int))
{
type.GetProperty(propertyInfo.Name).SetValue(model?? Convert.ToInt32(dr[propertyInfo.Name])?? null);
}
else if (propertytype == typeof(System.Nullable<double>) || propertytype == typeof(double))
{
type.GetProperty(propertyInfo.Name).SetValue(model?? Convert.ToDouble(dr[propertyInfo.Name])?? null);
}
else
{
type.GetProperty(propertyInfo.Name).SetValue(model?? dr[propertyInfo.Name]?? null);
}
}
}
return model;
}
??????÷???????????????
??????????????????public void Fun1<T>(T a);??public void Fun1<U>(U a);?????????????????????????T??U?????????????????????????
???????????????д????????????дFuncA????д????????FuncB????д???????????????????У???????д??
????abstract class BaseClass
????{
????public abstract T FuncA<T??U>(T t??U u) where U:T;
????public abstract T FuncB<T>(T t) where T:IComparable;
????}
????class ClassA:BaseClass
????{
????public override X FuncA<X??Y>(X x??Y y){...}
????public override T FuncB<T>(T t) where T:IComparable{...}
????}
??????2?????????????
????public class Class_Base<DTO?? T>
????{}
?????????????????????????????????
??????3????????????????е?????
??????????????????????????????????????????????????????
????public interface Interface_Base<T>
????{}
????public class Class_Base<DTO?? T> : Interface_Base<DTO>
????{}
????DTO??????????Class_Base
??????4????????е?????????????÷??????????ú?????????????????????????????
???????巺????У?
????public delegate void MyDelegate<T>(T obj);
??????????е?????
????public delegate void MyDelegate<T>(T obj);
????static void Main(string[] args)
????{
????var method = new MyDelegate<int>(printInt);
????method(1);
????Console.ReadKey();
????}
????static void printInt(int i)
????{
????Console.WriteLine(i);
????}
??????5??????????????????????????????Щ?????????????????????????
???????????????
????public class Imps_Base<DTO?? T> : Ifs_Base<DTO>
????where T : BaseEntity
????where DTO : class
????{
????}
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
???????C#?е?StringC# Socket???????????????????C#?????????????????????????C#???????C#????????????Log4net??????δ????C#?????????????C#?????????????????C#???????????????C#????????????????C#7 ?е?Tuple??????C#??TypeScript - GeneratorC# ?????????細(xì)??????????C#?е???н???C#??MySQL?????????μ??Ч?????д??C#????C++??dll???C#??VS2010????е??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????