Linked Questions

135 votes
3 answers
244k views

What options do I have when initializing string[] object?
mrblah's user avatar
  • 104k
34 votes
7 answers
88k views

i have seen [] such brackets in c# very very rarely but when i start to learn asp.net i have seen them many times but still i couldn't understand what they does ? They are not part of code as using ...
Freshblood's user avatar
  • 6,481
4 votes
5 answers
43k views

I need to initialize an array of three points. I want to write it like below, but only once for three elements. Point P = new Point { X = 0, Y = 1 }; Point[] P = new Point[3];// <---- ? How to ...
Mixer's user avatar
  • 1,332
0 votes
5 answers
6k views

There is a code where that reads something from the XML and loads it into dictionary. Pls find the code below. I need to understand what new [] {header} does. what is new [] doing here.Thanks in ...
Jayaraman's user avatar
  • 147
0 votes
3 answers
3k views

What are the syntax rules for creating an anonymous array? i.e. int[] function() { int element1 = 1; int element2 = 2; return //array with element1 and element2 { And what other uses does ...
RedAces's user avatar
  • 317
3 votes
1 answer
2k views

I want to inizialize a new int array. What are the advantages of: var myNewArray = new int[]{}; And: var myNewArray = new int[0]; Which one should I prefer over the other, or is it just a matter of ...
Mafii's user avatar
  • 7,495
0 votes
1 answer
7k views

I'm adding value to an array of bytes with the following code: byte[] ConnectionPath; ConnectionPath[0] = 0; ConnectionPath[1] = 2; ConnectionPath[2] = 1; ConnectionPath[3] = 0; My question is, can't ...
Belekz's user avatar
  • 599
0 votes
2 answers
3k views

I started studying C# a while back, and I always heard that if I do not have the size of the array, I should always choose list, because arrays can't be initialized without the size. That being said, ...
Nathan David's user avatar
0 votes
2 answers
7k views

I have this function in c#: public string CommitDocument(string extension, byte[] fileBytes) { // some code here } I'm trying to call this function like this: CommitDocument("document.docx", ...
IT Developer's user avatar
-2 votes
3 answers
4k views

What is the language grammatical problem in my code? I want to declare an array of queues. Is this the right way to declare and use them? public static void Main(string[] args) { ...
deepsigner's user avatar
0 votes
2 answers
2k views

I have a class as follows, its for an API so it must be in this format public class Command { public string response_type { get; set; } public string text { get; set; } public Attachment[]...
Dale Fraser's user avatar
  • 4,768
-1 votes
1 answer
4k views

I have a string representation of the Guid,I'm doing some testing and I'm hard-coding some GUIDs into the code. The below way can assign Guid of single value. Guid g = new Guid("11223344-5566-...
tartar's user avatar
  • 149
0 votes
1 answer
1k views

So I know with normal properties you can give it a default value eg. public int someMethod { get; } = 1; So my question is it possible to do the same with an array property? public int[] someMethod {...
Tim's user avatar
  • 67
-3 votes
1 answer
1k views

Is there a way to declare a array that contains float variables and that has a fixed size of an int? int balls = 5; float array posX[balls]; private float posY[] = 0; basically, I want to create an ...
JonTheBrownDog's user avatar
-1 votes
2 answers
386 views

What will be the difference between using keyword new in declaring a new array or not using it? I saw something like that on the internet but didn't fully understand the difference: new keyword on the ...
AldersonMike's user avatar

15 30 50 per page
1
2 3 4 5