如何将一种数据类型转换为另一种 [英] how to convert one data type to another

查看:108
本文介绍了如何将一种数据类型转换为另一种的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为类别项目创建了一张表...在其中我提到了类型为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[^]


这篇关于如何将一种数据类型转换为另一种的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆