Today when I was working I my project, I need to convert the List into a DataTable for some reasons. I goggled it and get some solutions for this. But I get a very good solution Here.So I am posting that solution for my readers.
In my previous posts, I explained Get Property Names using Reflection in C#, Hard drive information using C#, Create Directory/Folder using C#, Check Internet Connection using C#, SQL Server Database BackUp using C#, Partial Methods, Contextual Keyword, C# Static Methods and some other articles related to C#, ASP.Net and SQL Server.
In my previous posts, I explained Get Property Names using Reflection in C#, Hard drive information using C#, Create Directory/Folder using C#, Check Internet Connection using C#, SQL Server Database BackUp using C#, Partial Methods, Contextual Keyword, C# Static Methods and some other articles related to C#, ASP.Net and SQL Server.
Here,I have not constrained reference type or value type only. We need to take care of both the cases while converting List to DataTable as the underlying type can be both value or reference type.