On Tue, 25 Sep 2007 15:15:47 -0400, "John Saunders [MVP]"
[quoted text, click to view] <john.saunders at trizetto.com> wrote:
>"Ren" <nospam@nospam.org> wrote in message
>news:ikmif312kc2n1sucbqfihblacabt484hgh@4ax.com...
>> Hello all,
>>
>> I am trying to localize some of the web methods in my web service so
>> I've created an enum in my web service of the allowed languages:
>>
>> public enum Language
>> english
>> french
>> end enum
>>
>> The first parameter in my new web methods is of the type "language".
>> On my client side if I pass either "english" or "french" everything is
>> fine, however if I leave the parameter blank I receive the error:
>>
>> Cannot convert to WebService.Service+Language.
>> Parameter name: type --> Must specify valid information for parsing in
>> the string.
>>
>> Is there anyway that I can accept either a blank (null) or an enum
>> value for this parameter without throwing this error if the value is
>> blank? I'd like to be able to default the language to english if no
>> language is specified.
>
>Could you do that in VB? Is blank or null a valid value for your enum?
>
>If you're using .NET 2.0, you could try using a nullable type for your
>parameter. It would be of type Nullable(Of Language).
Hi John, thanks for your reply. I should have specified that I'm
still using version 1.1 of the framework and coding in VB. I'm not
sure how to specify blank as a valid value in my enum since "" is an
invalid value. I'd like to specify both "" (blank) and Nothing as
valid values in the enum but don't think that's possible.
I suppose that I could try and enclose the enum in a wrapper class.
I'm coming to the conclusion that an enum is probably not the best way