What kind of memory semantics govern array assignment in c#?

后端 未结 7 1029
长情又很酷
长情又很酷 2021-01-19 04:12

Given the following: byte[] sData; and a function declared as private byte[] construct_command()

if I were to then assign the resul

7条回答
  •  感情败类
    2021-01-19 04:29

    sData will point to the contents of what's returned from the function. Arrays in C# are reference types, which means that assigning one array from another simply copies the reference rather than allocating new data.

提交回复
热议问题