如何存储数组 [英] How to store an array

查看:86
本文介绍了如何存储数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我想存储一个数组.一个值可以存储在hiddenfield中,就像如何存储数组一样.我使用viewstate和session,但仅在数组中获取第一个值.
在此先感谢

Hi all
I want to store an array.A single value can stored in hiddenfield .like that how to store an array.I use viewstate and session but getting first value in array only.
Thanks in advance

推荐答案

嗨Amritha444,

尝试以下代码...

在这里,我正在使用会话对象来存储数组值并将会话值获取到另一个数组中.

将数组值存储到会话对象中.
Hi Amritha444,

Try the following code...

Here i am using session object to store the array value and get session value into another array.

Store the Array Value into Session Object..
string[] sArrVal = new string[] { "A","B","C","D" };
Session["ArrVal"] = sArrVal;



从会话对象获取值..



Get the value from Session Object..

string[] sGetArrVal = (string[])Session["ArrVal"];



尝试这种方式..我希望它对您有用..

干杯:)



Try this way..i hope its useful to you..

Cheers :)


这篇关于如何存储数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆