© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•9mo ago•
6 replies
jd

✅ Creating arrays

I’m coming from C where I can either create an array by doing int num[]={…}; or int num[2];

It seems that for C# there are many different ways to do it. I understand int[] x = {1,2,3}; and int[] x = new int[3];

I am confused on how int[]x = new int[] {1,2,3}; works, I am confused on how this isn’t the same as int[] x = {1,2,3};

Also am I able to just do int[] x?
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
C#CC# / help
3mo ago
Arrays
C#CC# / help
4y ago
✅ arrays addition
C#CC# / help
2y ago
Joining arrays
C#CC# / help
2y ago