Posts

Showing posts from May, 2009

Generic Lists to Datasets

Easy way to push a Generic List into a Dataset ** Note 'tasks' is the name of my generic list class Public Function ConvertGenericsListToDataSet( ByVal listvalue As tasks()) As DataSet Dim sb As New StringBuilder() Dim xmlSerializer As New XmlSerializer( GetType (tasks())) Dim sw As New StringWriter(sb) xmlSerializer.Serialize(sw, listvalue) Dim stream As New StringReader(sb.ToString()) Dim ds As New DataSet() ds.ReadXml(stream) Return ds End Function