Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# method parameter syntax - what does this mean? [duplicate]

Once I know what this means, there's probably a better way of expressing this question, but I don't know where to start.

Here's the Read method for a StreamReader:

public override int Read([In, Out] char[] buffer, int index, int count) { ... }

That "In, Out" bit - what is it for, what does it do, what's it called?

like image 599
Party Ark Avatar asked Feb 27 '13 10:02

Party Ark


Video Answer


1 Answers

That "In, Out" bit - what is it for, what does it do, what's it called?

They are parameter attributes.

In this case System.Runtime.InteropServices.InAttribute and System.Runtime.InteropServices.OutAttribute which are used for interop with code outside the .NET runtime.

like image 73
Richard Avatar answered Oct 13 '22 06:10

Richard