Connecting Tech Pros Worldwide Forums | Help | Site Map

session help

=?Utf-8?B?cm9kY2hhcg==?=
Guest
 
Posts: n/a
#1: Aug 18 '08
hey al,
i you had a choice between keeping an array or struct which one would you
choose (and is this a valid question)?

thanks,
rodchar

=?Utf-8?B?cm9kY2hhcg==?=
Guest
 
Posts: n/a
#2: Aug 19 '08

re: session help


sorry for the confustion,
I have several different types of variables that I would like to store in
Session. I was wondering if it would be better to use a struct or an array of
some sort to store these values in Session.

"Patrice" wrote:
Quote:
Are you asking if you should store values using a bidimensional array or a
unidimensional array that would store structures ?
>
IMO a struct would give a better lisibility and type safety. An array could
be acceptable if the "property" index uses named constants (for lisibility)
and if all cells are of the same type...
>
If this is not what you are looking try to be more explicit when asking a
question...
>
--
Patrice
>
"rodchar" <rodchar@discussions.microsoft.coma crit dans le message de
groupe de discussion : 4EB56888-9EB8-408B-A1C1-62514C616996@microsoft.com...
Quote:
hey al,
i you had a choice between keeping an array or struct which one would you
choose (and is this a valid question)?

thanks,
rodchar
>
>
Patrice
Guest
 
Posts: n/a
#3: Aug 19 '08

re: session help


I'm still not sure to really catch what you mean. What is the benefit you
expect from using a struct or an array ? How do you plan to use them ?

My favorite approach is something such as :

http://www.codeproject.com/KB/aspnet...sionstate.aspx

(basically you create a strongly typed class that stores the underlying
values as session variables)

Is this what you are looking for ?

--
Patrice

"rodchar" <rodchar@discussions.microsoft.coma écrit dans le message de
groupe de discussion : 338F737E-B80C-422E-B489-4999E3A5E75E@microsoft.com...
Quote:
sorry for the confustion,
I have several different types of variables that I would like to store in
Session. I was wondering if it would be better to use a struct or an array
of
some sort to store these values in Session.


=?Utf-8?B?cm9kY2hhcg==?=
Guest
 
Posts: n/a
#4: Aug 19 '08

re: session help


yes, that is it exactly. I just wanted to know the most light-weight and
efficient way to store an array of different types variables. I thought using
a struct would be more light-weight than a class or an array? or does it
matter?

"Patrice" wrote:
Quote:
I'm still not sure to really catch what you mean. What is the benefit you
expect from using a struct or an array ? How do you plan to use them ?
>
My favorite approach is something such as :
>
http://www.codeproject.com/KB/aspnet...sionstate.aspx
>
(basically you create a strongly typed class that stores the underlying
values as session variables)
>
Is this what you are looking for ?
>
--
Patrice
>
"rodchar" <rodchar@discussions.microsoft.coma crit dans le message de
groupe de discussion : 338F737E-B80C-422E-B489-4999E3A5E75E@microsoft.com...
Quote:
sorry for the confustion,
I have several different types of variables that I would like to store in
Session. I was wondering if it would be better to use a struct or an array
of
some sort to store these values in Session.
>
>
>
Patrice
Guest
 
Posts: n/a
#5: Aug 20 '08

re: session help


What is your language ? You'll find a class vs struct comparison in your
documentation. I'm not sure about why you compare them with an array which
has a different purpose.

If you meant you could also store member values as cells in an array, I
would strongly recommend stop bothering with micro optimization. This is
typically the kind of thing you'll never noticed because even if one is
twice as fast as the other you'll gain few microseconds anyway (i.e you
could even go from 0,005 s to 0,050 s without noticing while going from 5 s
to 50 s is much more noticable though in both cases you are 10 times faster)
and you'll losee a lot in term of clarity.

Use whatever is at your disposal and makes sense from a logical point of
view. Unless you have quite obvious concerns with a performance problem
rather than being too paranoid about them....

--
Patrice

"rodchar" <rodchar@discussions.microsoft.coma écrit dans le message de
groupe de discussion : 2A1691DF-A026-43F7-B22C-1025622EC2B8@microsoft.com...
Quote:
yes, that is it exactly. I just wanted to know the most light-weight and
efficient way to store an array of different types variables. I thought
using
a struct would be more light-weight than a class or an array? or does it
matter?
>


Patrice
Guest
 
Posts: n/a
#6: Aug 20 '08

re: session help


Messed a bit the end and English is not my native language. Basically don't
deal with performance problems too early i.e. using an integer rather than
a double or a struct instead of a class is unlikely to cause a performance
problem...

The link I talked about is :
http://msdn.microsoft.com/en-us/libr...71(VS.71).aspx (C#)

I'm unable to find the VB.NET counterpart but this is basically the same...

--
Patrice

"Patrice" <http://www.chez.com/scribe/a écrit dans le message de groupe de
discussion : A65E61B6-4AE6-4BC5-9DE3-6E4AA770FB53@microsoft.com...
Quote:
What is your language ? You'll find a class vs struct comparison in your
documentation. I'm not sure about why you compare them with an array which
has a different purpose.
>
If you meant you could also store member values as cells in an array, I
would strongly recommend stop bothering with micro optimization. This is
typically the kind of thing you'll never noticed because even if one is
twice as fast as the other you'll gain few microseconds anyway (i.e you
could even go from 0,005 s to 0,050 s without noticing while going from 5
s to 50 s is much more noticable though in both cases you are 10 times
faster) and you'll losee a lot in term of clarity.
>
Use whatever is at your disposal and makes sense from a logical point of
view. Unless you have quite obvious concerns with a performance problem
rather than being too paranoid about them....
>
--
Patrice
>
"rodchar" <rodchar@discussions.microsoft.coma écrit dans le message de
groupe de discussion :
2A1691DF-A026-43F7-B22C-1025622EC2B8@microsoft.com...
Quote:
>yes, that is it exactly. I just wanted to know the most light-weight and
>efficient way to store an array of different types variables. I thought
>using
>a struct would be more light-weight than a class or an array? or does it
>matter?
>>
>
>
>
=?Utf-8?B?cm9kY2hhcg==?=
Guest
 
Posts: n/a
#7: Aug 20 '08

re: session help


thanks for the advice,
rod.

"Patrice" wrote:
Quote:
Messed a bit the end and English is not my native language. Basically don't
deal with performance problems too early i.e. using an integer rather than
a double or a struct instead of a class is unlikely to cause a performance
problem...
>
The link I talked about is :
http://msdn.microsoft.com/en-us/libr...71(VS.71).aspx (C#)
>
I'm unable to find the VB.NET counterpart but this is basically the same...
>
--
Patrice
>
"Patrice" <http://www.chez.com/scribe/a écrit dans le message de groupe de
discussion : A65E61B6-4AE6-4BC5-9DE3-6E4AA770FB53@microsoft.com...
Quote:
What is your language ? You'll find a class vs struct comparison in your
documentation. I'm not sure about why you compare them with an array which
has a different purpose.

If you meant you could also store member values as cells in an array, I
would strongly recommend stop bothering with micro optimization. This is
typically the kind of thing you'll never noticed because even if one is
twice as fast as the other you'll gain few microseconds anyway (i.e you
could even go from 0,005 s to 0,050 s without noticing while going from 5
s to 50 s is much more noticable though in both cases you are 10 times
faster) and you'll losee a lot in term of clarity.

Use whatever is at your disposal and makes sense from a logical point of
view. Unless you have quite obvious concerns with a performance problem
rather than being too paranoid about them....

--
Patrice

"rodchar" <rodchar@discussions.microsoft.coma écrit dans le message de
groupe de discussion :
2A1691DF-A026-43F7-B22C-1025622EC2B8@microsoft.com...
Quote:
yes, that is it exactly. I just wanted to know the most light-weight and
efficient way to store an array of different types variables. I thought
using
a struct would be more light-weight than a class or an array? or does it
matter?
>
>
>
Closed Thread


Similar ASP.NET bytes