是否有功能在C#中的指针? [英] are there function pointers in c#?

查看:89
本文介绍了是否有功能在C#中的指针?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学习一些C#代码,如果函数指针的C ++概念包括在C#不知道。我看到有这样的事情委托。他们是同一个概念?还是他们在更根本的层面有什么不同?

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 concept? or do they differ on a more fundamental level?

推荐答案

代表基本上是函数指针,但内置了额外的多播功能。所以,你可以分配多个功能相同的委托,他们都将在序列被称为当委托被调用。

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.

与会代表还具有内置的异步接口,指定当新功能为委托具有CO /禁忌方差(在.NET 4中,而且,周围路过时代表)

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)

这篇关于是否有功能在C#中的指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆