Tuesday, February 1, 2011

Converting a string Array to a Guid Array with one line of C# Code

This is no big deal. We can get this done in using looping through an array also. But I checked the google and found out about how to get this done form one line of code.
The Code line is below for your reference.

GuidArray = Array.ConvertAll(StringArray, delegate(string stringID) { return new Guid(GuidID); });

StringArray = string array
stringID = string variable
GuidID = Guid variable
GuidArray = Final Guid Array

No comments:

Post a Comment

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...