© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
17 replies
ByGoalZ

Newbie question: Decleration of stack vs Arrays

Hello,
so I know the basics of C# but one thing I never understood or learned was how data structures are being created/declared
So there are like 3+ ways of declaring an array, I typically use:
String[] example = new string[3];
(First question: What is new for? Why is it being used here?)
And today I learned stacks but they are declared differently:
Stack<int> stack = new Stack<int>();
So why is that? Why isnt it
Stack[int] stack = new Stack; And what are the brackets for
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Arrays of floats in stack
C#CC# / help
13mo ago
❔ ✅ Lists vs arrays vs ArrayLists and jagged arrays and dictionaries vs hashtables
C#CC# / help
3y ago
✅ Newbie question on Random function
C#CC# / help
3y ago
Use of inline arrays to model arrays of structs
C#CC# / help
6mo ago