如何将一种数据类型转换为另一种
问题描述:
我为类别项目创建了一张表...在其中我提到了类型为datetime数据类型的lastupdateddate ...在3层体系结构中开发此应用程序...在业务层中如何提及datetime数据类型以及如何进行转换将其保存在表中的日期时间
i have created one table for category items...in that i mentioned lastupdateddate of type datetime datatype...i m developing this application in 3 tier architecture...in business layer how to mention the datetime datatype and how to convert it in date time to save in table
答
许多.NET类型都支持TypeConverter:
Many of the .NET types support the TypeConverter:
TypeConverter converter = TypeDescriptor.GetConverter(targetType);
return converter.ConvertFrom(value);
您可以在我的文章 Generic WPF/Silverlight Value Converter [ ^ ]
You can read about it in my article Generic WPF/Silverlight Value Converter[^]