Friday, May 10, 2013

How to convert an array of one type to another type in using Linq in .NET

Following is the sample code that converts a string array into GUID array with faster performance:

String strGUIDs[];
//Consider the above array is containing all GUIDs in string format.
Guid[] guids = Array.ConvertAll(strGUIDs, x => Guid.Parse(x));

You can convert an array from one type to another using the above approach.

No comments:

Post a Comment

Thanks for visiting my blog.
However, if this helped you in any way, please take a moment to write a comment.

Thanks
Nirman