C
C#2mo ago
Cool4funny

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
Cool4funny2mo ago
without <> too
Angius
Angius2mo ago
Any reason you want to avoid generics? I assume that's what you mean by "without <>"
Cool4funny
Cool4funny2mo ago
i have no idea whats this i gtg
Angius
Angius2mo 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
Cool4funny2mo ago
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
Angius2mo 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
Cool4funny2mo ago
Can you explain it whats its doing? like whats var?
leowest
leowest2mo 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
Cool4funny2mo ago
is it possible to make it without var?
Angius
Angius2mo 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
More Posts