Filling a byte array (MSDN examples vs. “other”)

Is there a reason Microsoft initializes byte arrays like this:

string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; byte[] buffer = Encoding.ASCII.GetBytes(data); 

vs:

byte[] buffer = new byte[32]; 

Source: http://ift.tt/1PkBGzb

(Side note: SysAdmin here, just picking up some C# to add to the scripting/programming tool set. Sorry if this is a painfully obvious question!)

by Northbr1dge via /r/csharp

Leave a Reply