are there function pointers in c#?

前端 未结 6 1262
后悔当初
后悔当初 2020-12-07 01:40

I am trying to learn some c# coding and wondering if the c++ concept of function pointers is included in c#. I see there are such things as delegates. Are they the same co

6条回答
  •  抹茶落季
    2020-12-07 02:06

    Delegates are essentially function pointers, but with extra multicast capabilities built in. So you can assign several functions to the same delegate, and they will all be called in sequence when the delegate is called.

    Delegates also have built-in asynchronous interfaces, and have co/contra variance when assigning new functions to a delegate (and, in .NET 4, when passing delegates around)

提交回复
热议问题