|
Home > Archive > BizTalk Server Orchestration > September 2004 > Expression Shape - Converting GUID to string variable in one line/
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Expression Shape - Converting GUID to string variable in one line/
|
|
| Neal Walters 2004-09-28, 8:14 am |
|
I'd like to convert a GUID to a string on one line of code instead of two.
//Biztalk does not like either of these two lines of code
// which work fine in C# (vStrGUID is a string variable)
// Says "illegal dotted name" on the Guid().ToString
// and says "an object ref is required for a non-static field
//vStrGUID = System.Guid.NewGuid().ToString();
//vStrGUID = (System.Guid.NewGuid()).ToString();
// This works fine (so far)
vGUID = System.Guid.NewGuid();
vStrGUID = vGUID.ToString();
Is this one of those cases where XLangS is just different than C#???
Thanks in advance,
Neal Walters
http://Biztalk-Training.com - Biztalk 2004 Training Videos
| |
| Alan Smith 2004-09-28, 5:52 pm |
| Hi Neal,
Try this:
vStrGUID = System.String.Format ("{0}", System.Guid.NewGuid ());
I often find I have to jump through a few hoops to get XLANG/s to do
something.
It would be good to see some examples of "Best Practices" and code examples.
Regards,
Alan
"Neal Walters" wrote:
>
> I'd like to convert a GUID to a string on one line of code instead of two.
>
> //Biztalk does not like either of these two lines of code
> // which work fine in C# (vStrGUID is a string variable)
> // Says "illegal dotted name" on the Guid().ToString
> // and says "an object ref is required for a non-static field
>
> //vStrGUID = System.Guid.NewGuid().ToString();
> //vStrGUID = (System.Guid.NewGuid()).ToString();
>
> // This works fine (so far)
> vGUID = System.Guid.NewGuid();
> vStrGUID = vGUID.ToString();
>
> Is this one of those cases where XLangS is just different than C#???
>
> Thanks in advance,
> Neal Walters
> http://Biztalk-Training.com - Biztalk 2004 Training Videos
>
| |
| Devdutt Patnaik 2004-09-28, 5:52 pm |
| Neal,
System.Convert.ToString(System.Guid.NewGuid());
doesn't give any compilation errors, you might wanna check if it works.
Regards
Dev
"Neal Walters" <NealWalters@discussions.microsoft.com> wrote in message
news:0C371F1F-660C-4FF6-93CE-356AAC36AFED@microsoft.com...
>
> I'd like to convert a GUID to a string on one line of code instead of two.
>
> //Biztalk does not like either of these two lines of code
> // which work fine in C# (vStrGUID is a string variable)
> // Says "illegal dotted name" on the Guid().ToString
> // and says "an object ref is required for a non-static field
>
> //vStrGUID = System.Guid.NewGuid().ToString();
> //vStrGUID = (System.Guid.NewGuid()).ToString();
>
> // This works fine (so far)
> vGUID = System.Guid.NewGuid();
> vStrGUID = vGUID.ToString();
>
> Is this one of those cases where XLangS is just different than C#???
>
> Thanks in advance,
> Neal Walters
> http://Biztalk-Training.com - Biztalk 2004 Training Videos
>
|
|
|
|
|