Skip to content
Merged
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
22 changes: 19 additions & 3 deletions docs/csharp/misc/cs0193.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: "Compiler Error CS0193"
title: "Compiler Error CS0193"
ms.date: 07/20/2015
ms.date: 05/27/2025
f1_keywords:
- "CS0193"
helpviewer_keywords:
Expand All @@ -10,9 +10,9 @@ ms.assetid: 7b60fd99-9eee-4d61-ad75-585a16e22e96
---
# Compiler Error CS0193

The \* or -> operator must be applied to a pointer
The \* or -> operator must be applied to a data pointer

The \* or -> operator was used with a nonpointer type. For more information, see [Pointer types](../language-reference/unsafe-code.md#pointer-types).
The \* or -> operator was used with a nonpointer type or with a function pointer. Function pointers cannot be dereferenced in C#. For more information, see [Pointer types](../language-reference/unsafe-code.md#pointer-types) and [Function pointers](../language-reference/unsafe-code.md#function-pointers).

The following sample generates CS0193:

Expand Down Expand Up @@ -45,3 +45,19 @@ public class MyClass
}
}
```

The following example shows that function pointers cannot be dereferenced in C#, unlike in C/C++:

```csharp
unsafe class FunctionPointerExample
{
public static void Log() { /* ... */ }

public static unsafe void Example()
{
delegate*<void> fp = &Log; // pointer to managed function Log()
fp(); // OK; call Log() via function pointer
(*fp)(); // Error; CS0193, function pointers cannot be dereferenced
}
}
```