Help With hints on how can i make multipull accounts using like arrays or something similar to array

i just want an easy way this is my code GIve me hitns only
No description
No description
No description
11 Replies
Cool4funny But The Cool 4 funny
without <> too
Angius
Angius9mo ago
Any reason you want to avoid generics? I assume that's what you mean by "without <>"
Cool4funny But The Cool 4 funny
i have no idea whats this i gtg
Angius
Angius9mo ago
Well, in any case, you already seem to have a bank account class So just have an array or a list of them Boom, you have multiple
Cool4funny But The Cool 4 funny
can you show me an example? since ik arrays have a limit on how much you want inside And One Doesent or with vectors like show me the diffs with both
Angius
Angius9mo ago
Yes, List<T> is dynamically-sized, and T[] (array) has a preset size And how would you use a list, for example? Well, quite simple
var accounts = new List<BankAccount> {
new BankAccount(),
new BankAccount(),
new BankAccount(),
};
var accounts = new List<BankAccount> {
new BankAccount(),
new BankAccount(),
new BankAccount(),
};
Cool4funny But The Cool 4 funny
Can you explain it whats its doing? like whats var?
leowest
leowest9mo ago
var is a compile time variable that the compiler changes it to the right hand when compiled. So essentially it is List<BankAccount> for example:
var str = "test"; // var is string
var num = 10; // var is int
var accounts = new List<BankAccount>(); // var is List<BankAccount>
var str = "test"; // var is string
var num = 10; // var is int
var accounts = new List<BankAccount>(); // var is List<BankAccount>
Cool4funny But The Cool 4 funny
is it possible to make it without var?
Angius
Angius9mo ago
Sure
List<BankAccount> accounts = new List<BankAccount> {
new BankAccount(),
new BankAccount(),
new BankAccount(),
};
List<BankAccount> accounts = new List<BankAccount> {
new BankAccount(),
new BankAccount(),
new BankAccount(),
};
Want results from more Discord servers?
Add your server