Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 11, 2012 07:30 PM by nicofred
Member
10 Points
14 Posts
Jan 11, 2012 04:58 PM|LINK
Hello,
I'm a beginner and I want to use the same array in all my pages.
I've written the code below with a very simple array. It seems to work. But is that correct:
int [,] t=new int[3];
t[0]=0;
t[1]=12;
t[2]=31;
App.r=t;
and now I access to my array with: App.r
for exemple, if I want to change a cell :
App.r[1]=33;
Is that correct or far fetched?
thanks for your help
Contributor
3763 Points
858 Posts
Jan 11, 2012 05:25 PM|LINK
http://msdn.microsoft.com/en-us/library/aa288453%28v=vs.71%29.aspx
http://msdn.microsoft.com/en-us/library/9b9dty7d%28v=vs.80%29.aspx
http://csharp.net-tutorials.com/basics/arrays/
http://www.c-sharpcorner.com/UploadFile/mahesh/WorkingWithArrays11232005064036AM/WorkingWithArrays.aspx
Jan 11, 2012 06:15 PM|LINK
thanks for your answer
but my question is not how to use array but about App.r with an array
is it possible to use the property of the application and write: App.r=t (with t is an array)
thanks a lot
All-Star
154856 Points
19857 Posts
Moderator
MVP
Jan 11, 2012 07:20 PM|LINK
nicofred Is that correct or far fetched?
That's absolutely fine, and a perfectly legitimate use of the Application level variable. You can apply any kind of object (string, array, List<T> etc) to a dynamic property.
Jan 11, 2012 07:30 PM|LINK
great!
thanks a lot!
nicofred
Member
10 Points
14 Posts
Array : Is that correct?
Jan 11, 2012 04:58 PM|LINK
Hello,
I'm a beginner and I want to use the same array in all my pages.
I've written the code below with a very simple array. It seems to work. But is that correct:
int [,] t=new int[3];
t[0]=0;
t[1]=12;
t[2]=31;
App.r=t;
and now I access to my array with: App.r
for exemple, if I want to change a cell :
App.r[1]=33;
Is that correct or far fetched?
thanks for your help
devensawant
Contributor
3763 Points
858 Posts
Re: Array : Is that correct?
Jan 11, 2012 05:25 PM|LINK
http://msdn.microsoft.com/en-us/library/aa288453%28v=vs.71%29.aspx
http://msdn.microsoft.com/en-us/library/9b9dty7d%28v=vs.80%29.aspx
http://csharp.net-tutorials.com/basics/arrays/
http://www.c-sharpcorner.com/UploadFile/mahesh/WorkingWithArrays11232005064036AM/WorkingWithArrays.aspx
If my post helps you then please mark as answer
nicofred
Member
10 Points
14 Posts
Re: Array : Is that correct?
Jan 11, 2012 06:15 PM|LINK
thanks for your answer
but my question is not how to use array but about App.r with an array
is it possible to use the property of the application and write: App.r=t (with t is an array)
thanks a lot
Mikesdotnett...
All-Star
154856 Points
19857 Posts
Moderator
MVP
Re: Array : Is that correct?
Jan 11, 2012 07:20 PM|LINK
That's absolutely fine, and a perfectly legitimate use of the Application level variable. You can apply any kind of object (string, array, List<T> etc) to a dynamic property.
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
nicofred
Member
10 Points
14 Posts
Re: Array : Is that correct?
Jan 11, 2012 07:30 PM|LINK
great!
thanks a lot!