| |

VerySource

 Forgot password?
 Register
Search
Author: zhbibi

About dynamically taking the value of a variable name

[Copy link]

0

Threads

9

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-5-8 10:30:01
| Show all posts
1. Nothing works with Hashtable
[SerializableAttribute]
public class CartItemInfo: Hashtable {
    public CartItemInfo (string itemId, string name, int qty, decimal price, string type, string categoryId, string productId) {
     ....
    }
}
2. The impact of performance You can see the difference by cycling thousands of times.
3. The original CartItemInfo personally feels that there is nothing wrong with it. If each class needs an index value method, you can add a method instead of replacing it all (you can write a base class to inherit it and modify it for convenience). If not required for every class
I think it's enough to write a static method.
========================
for reference only
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