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); 


byte[] buffer = new byte[32]; 


(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