Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions docs/csharp/language-reference/compiler-messages/cs8355.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
description: "Compiler Error CS8355"
title: "Compiler Error CS8355"
ms.date: 12/10/2023
f1_keywords:
- "CS8355"
helpviewer_keywords:
- "CS8355"
---
# Compiler Error CS8355

An in parameter cannot have the Out attribute.

The parameter of a method can't be declared as read only, while informing interop marshaler to treat this parameter as writable by the native code.
<br/><xref:System.Runtime.InteropServices.OutAttribute> will contradict to the `in` keyword when [marshalling](../../../standard/native-interop/type-marshalling.md).

## Example

The following sample generates CS8355:

```csharp
using System.Runtime.InteropServices;

class Program
{
public static void Example([Out] in int value) // CS8355
{
}
}
```

## See also

- [Default Marshalling Behavior](../../../framework/interop/default-marshalling-behavior.md)
- [Reference parameters](../keywords/method-parameters.md#reference-parameters)
2 changes: 2 additions & 0 deletions docs/csharp/language-reference/compiler-messages/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,8 @@ items:
href: cs8334.md
- name: CS8354
href: cs8354.md
- name: CS8355
href: cs8355.md
- name: CS8403
href: cs8403.md
- name: CS8410
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ f1_keywords:
- "CS8349"
- "CS8350"
- "CS8353"
- "CS8355"
- "CS8356"
- "CS8357"
- "CS8359"
Expand Down