paulwhelan
asked on
Changing type of some variables
Hi
Im making changes to some code. We had a variable
private string InitialValue
which was used for five different 'data types' (number, date, string, boolean and enumerator)
so it was suggested that instead of it being
private string InitialValue
for each of the five it should be
private object InitialValue
And then within 'number' it should be
private decimal InitialValue
and within 'date' it should be
private datetime InitialValue
and within 'string' it should be
private boolean InitialValue
and within 'boolean' it should be
private datetime InitialValue
with the aim being that only decimals will be entered as the Initial Value for a number, only booleans will be entered as the Initial Value for booleans.
My question is what should it be for enumerator?
Any questions let me know
Thanks
Paul
Im making changes to some code. We had a variable
private string InitialValue
which was used for five different 'data types' (number, date, string, boolean and enumerator)
so it was suggested that instead of it being
private string InitialValue
for each of the five it should be
private object InitialValue
And then within 'number' it should be
private decimal InitialValue
and within 'date' it should be
private datetime InitialValue
and within 'string' it should be
private boolean InitialValue
and within 'boolean' it should be
private datetime InitialValue
with the aim being that only decimals will be entered as the Initial Value for a number, only booleans will be entered as the Initial Value for booleans.
My question is what should it be for enumerator?
Any questions let me know
Thanks
Paul
>> My question is what should it be for enumerator?
it should be the same type as your enum.
for exmaple if you have an enum called X then is should be
private X var
it should be the same type as your enum.
for exmaple if you have an enum called X then is should be
private X var
ASKER
But see the way I changed
private object InitialValue
to
private string InitialValue
(for string)
and
private object InitialValue
to
private datetime InitialValue
(for date)
etc...
How would I represent an enum?
Thanks
Paul
private object InitialValue
to
private string InitialValue
(for string)
and
private object InitialValue
to
private datetime InitialValue
(for date)
etc...
How would I represent an enum?
Thanks
Paul
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
And then within 'number' it should be
private decimal InitialValue
and within 'date' it should be
private datetime InitialValue
and within 'string' it should be
private string InitialValue
and within 'boolean' it should be
private boolean InitialValue