From: Andr� Freitas on
Whats the best way to implement a dictionary like class who gets 3 columns.
Like:

"name", "regex", "error msg"

Or

"name", "reg" and "name", "error msg"

Regards,
Andr�


From: Mark Rae [MVP] on
"Andr� Freitas" <andrefreitas> wrote in message
news:%23rLVDLDmKHA.1540(a)TK2MSFTNGP06.phx.gbl...

> Whats the best way to implement a dictionary like class who gets 3
> columns. Like:
>
> "name", "regex", "error msg"
>
> Or
>
> "name", "reg" and "name", "error msg"

A Dictionary is composed of two parts - a key and a value - so neither of
the above would fit into a Dictionary directly

It would be helpful if you could explain a little more about what you are
trying to achieve...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

From: Andr� Freitas on
Well, im trying to set default regex and default error message to all kinds
of inputs in the project, since today theres a mess, same fields validated
with diferent regex.

I can have 2 dictionarys... one for regular expressions, one for error
messages, but im not sure about the best way to implement it in a easy way
to use.. its why im asking the professional tips =D

Regards


"Mark Rae [MVP]" <mark(a)markNOSPAMrae.net> escreveu na mensagem
news:eFCnXUDmKHA.5728(a)TK2MSFTNGP06.phx.gbl...
> "Andr� Freitas" <andrefreitas> wrote in message
> news:%23rLVDLDmKHA.1540(a)TK2MSFTNGP06.phx.gbl...
>
>> Whats the best way to implement a dictionary like class who gets 3
>> columns. Like:
>>
>> "name", "regex", "error msg"
>>
>> Or
>>
>> "name", "reg" and "name", "error msg"
>
> A Dictionary is composed of two parts - a key and a value - so neither of
> the above would fit into a Dictionary directly
>
> It would be helpful if you could explain a little more about what you are
> trying to achieve...
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net


From: Mark Rae [MVP] on
"Andr� Freitas" <andrefreitas> wrote in message
news:Ozc0qtDmKHA.2164(a)TK2MSFTNGP02.phx.gbl...

[please don't top-post]

>>> Whats the best way to implement a dictionary like class who gets 3
>>> columns. Like:
>>>
>>> "name", "regex", "error msg"
>>>
>>> Or
>>>
>>> "name", "reg" and "name", "error msg"

>> A Dictionary is composed of two parts - a key and a value - so neither of
>> the above would fit into a Dictionary directly
>>
>> It would be helpful if you could explain a little more about what you are
>> trying to achieve...

> Well, I'm trying to set default rage and default error message to all
> kinds of inputs in the project, since today there's a mess, same fields
> validated with different rage.
>
> I can have 2 Dictionaries... one for regular expressions, one for error
> messages, but I'm not sure about the best way to implement it in a easy
> way to use..

Assuming that the data is unlikely to change very often, I'd probably use a
DataTable which I'd create and populate in Application_Start and store in
Application memory. Then I'd just use standard ADO.NET functionality on it.
I do this for (almost) static data e.g. country codes, currency codes etc...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

From: Andr� Freitas on
> [please don't top-post]


>>>> Whats the best way to implement a dictionary like class who gets 3
>>>> columns. Like:
>>>>
>>>> "name", "regex", "error msg"
>>>>
>>>> Or
>>>>
>>>> "name", "reg" and "name", "error msg"


>>> A Dictionary is composed of two parts - a key and a value - so neither
>>> of the above would fit into a Dictionary directly
>>>
>>> It would be helpful if you could explain a little more about what you
>>> are trying to achieve...


>> Well, I'm trying to set default rage and default error message to all
>> kinds of inputs in the project, since today there's a mess, same fields
>> validated with different rage.
>>
>> I can have 2 Dictionaries... one for regular expressions, one for error
>> messages, but I'm not sure about the best way to implement it in a easy
>> way to use..

> Assuming that the data is unlikely to change very often, I'd probably use
> a DataTable which I'd create and populate in Application_Start and store
> in Application memory. Then I'd just use standard ADO.NET functionality on
> it. I do this for (almost) static data e.g. country codes, currency codes
> etc...


U meant something like that:

public string returnregexp(string fieldname)
{
/*
declare the datatable here and populate the datatable here
return the correct field using probaly a datatable.select
or using a dictionary like functionality
*/
}

Regards,


 |  Next  |  Last
Pages: 1 2 3
Prev: Popup if change in gridview
Next: Hotfix