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
2 changes: 1 addition & 1 deletion docs/csharp/delegates-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ As you'll see later in this series, the C# code you write for algorithms
like this is type safe, and uses the language rules and the compiler to
ensure that the types match for arguments and return types.

[Function pointers](~/_csharplang/proposals/csharp-9.0/function-pointers.md) were added to C# 9 for similar scenarios, where you need more control over the calling convention. The code associated with a delegate is invoked using a virtual method added to a delegate type. Using function pointers, you can specify different conventions.
[Function pointers](language-reference/unsafe-code.md#function-pointers) were added to C# 9 for similar scenarios, where you need more control over the calling convention. The code associated with a delegate is invoked using a virtual method added to a delegate type. Using function pointers, you can specify different conventions.

## Language Design Goals for Delegates

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ A `delegate` is a reference type that can be used to encapsulate a named or an a

The delegate must be instantiated with a method or lambda expression that has a compatible return type and input parameters. For more information on the degree of variance that is allowed in the method signature, see [Variance in Delegates](../../programming-guide/concepts/covariance-contravariance/using-variance-in-delegates.md). For use with anonymous methods, the delegate and the code to be associated with it are declared together.

Beginning with C# 9, you can declare [*function pointers*](../unsafe-code.md#function-pointers), which use similar syntax. A function pointer uses the `calli` instruction instead of instantiating a delegate type and calling the virtual `Invoke` method.

## The dynamic type

The `dynamic` type indicates that use of the variable and references to its members bypass compile-time type checking. Instead, these operations are resolved at run time. The `dynamic` type simplifies access to COM APIs such as the Office Automation APIs, to dynamic APIs such as IronPython libraries, and to the HTML Document Object Model (DOM).
Expand Down
4 changes: 2 additions & 2 deletions docs/csharp/language-reference/unsafe-code.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Unsafe code, pointers to data, and function pointers"
description: Learn about unsafe code, pointers, and function pointers. C# requires you to declare an unsafe context to use these features to directly manipulate memory or function pointers.
description: Learn about unsafe code, pointers, and function pointers. C# requires you to declare an unsafe context to use these features to directly manipulate memory or function pointers (unmanaged delegates).
ms.date: 04/01/2021
helpviewer_keywords:
- "security [C#], type safety"
Expand All @@ -12,7 +12,7 @@ helpviewer_keywords:
- "pointers [C#], about pointers"
ms.assetid: b0fcca10-a92d-4f2a-835b-b0ccae6739ee
---
# Unsafe code and pointer types
# Unsafe code, pointer types, and function pointers

Most of the C# code you write is "verifiably safe code." *Verifiably safe code* means .NET tools can verify that the code is safe. In general, safe code doesn't directly access memory using pointers. It also doesn't allocate raw memory. It creates managed objects instead.

Expand Down