as expected, calls my GenerateValidationError method, passing in some string like "The specified customer number was invalid". That's not quite what I want to do. In my method, I need to do some more related resource lookups and the like. So, what I really
want is for the argument passed to my method to be the underlying key value and not the resolved string - in other words, in this example it would be simply "InvalidCustomerNumber".
I'm struggling to work out how to take advantage of the strong typing (so that I can't specify an invalid resources key in the code) but, at the same time, keep it as the key value when it's passed to my method, rather than actually looking it up.
Hopefully I'm missing something simple and obvious.
NickLocke
Member
92 Points
147 Posts
Strongly typed resources - want the code, not the value
Oct 09, 2011 08:45 AM|LINK
Not really localisation, but I suspect this forum has the best knowledge of using resource files. This code:
as expected, calls my GenerateValidationError method, passing in some string like "The specified customer number was invalid". That's not quite what I want to do. In my method, I need to do some more related resource lookups and the like. So, what I really want is for the argument passed to my method to be the underlying key value and not the resolved string - in other words, in this example it would be simply "InvalidCustomerNumber".
I'm struggling to work out how to take advantage of the strong typing (so that I can't specify an invalid resources key in the code) but, at the same time, keep it as the key value when it's passed to my method, rather than actually looking it up.
Hopefully I'm missing something simple and obvious.
Thanks for any pointers,
Nick.
NickLocke
Member
92 Points
147 Posts
Re: Strongly typed resources - want the code, not the value
Oct 11, 2011 08:13 PM|LINK
I'm still wrestling this one. Anybody? Thanks, Nick.