| |

VerySource

 Forgot password?
 Register
Search
View: 820|Reply: 5

The problem of dynamically defining Hashtable!

[Copy link]

2

Threads

13

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-2 23:20:01
| Show all posts |Read mode
My code is as follows:
for (int i = 1; i <= 30; i ++)
{
Hashtable i.ToString (). Trim () = new Hashtable ();
}
My purpose is: I want to dynamically define multiple Hashtbale with regular names;

However, running the above code always gives an error:

I used to remember that when using vfp database, there was a macro replacement problem that could solve the above problems, but in asp.net, I don't know how to do it?

I also hope that experts advise:
How to define multiple Hashtables with a regular name through a loop. After the definition, how to find the corresponding Hashtable
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-2 23:57:01
| Show all posts
Then use an array
Reply

Use magic Report

2

Threads

13

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-1-3 00:21:01
| Show all posts
What about using arrays? Still looking for advice "
Reply

Use magic Report

2

Threads

13

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-1-3 18:00:01
| Show all posts
咋 No one is talking
Reply

Use magic Report

0

Threads

41

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-1-3 20:12:01
| Show all posts
Hashtable [] ht = new Hashtable [30];
for (int i = 1; i <= 30; i ++)
            {
Ht [i] = new Hashtable ();
            }
Reply

Use magic Report

0

Threads

60

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-1-3 20:15:01
| Show all posts
Hashtable i.ToString (). Trim () = new Hashtable ();
This sentence is wrong, right upstairs
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list