English 中文(简体)
网上操作员
原标题:.net Operator Overloading

为什么需要一些运营商。 例如,比较操作者。

<   <=   >   >=   =  <>

你们还必须执行补充措施?

<  >=

限制你只执行目标

<

如果对它有具体意义,

>= 

does

<>说明: 环绕一号工作是把奥索尔迪特归属于不想要的经营者。

问题回答

操作员在Net(至少为C#和VB)上超负荷工作,故意比C++上载的操作员低灵活性。

One reason that Java went so far as to remove overloading entirely is that too many developers abused overloading to do clever-looking things that confused other developers and broke core assumptions of generic algorithms that expect to be able to, say, reasonably compare two instances of a user type.

虽然“网络”使一些灵活性有所回升,但设计者谨慎行事,只允许某些操作者超负荷工作,其意图是只将其用于其习惯含义。

要求进行对称操作者的比较,是这一意图的明证。

如果你想做更积极的操作者超负荷工作,我鼓励你考虑使用F#,在那里,你可以接触到一个范围更广的象征物,以吸引 operator操作者符号。

或许是因为如果你超负荷经营人一方,你正在执行某些习惯规则,而违约经营人不符合你的规则,从而产生奇怪的行为。

例如,如果你对内乱的定义;是返回(x > 5); (出于某种原因......)和你对内障的相反规则表示过重视;然后是经营者;

4 > 1(根据你的规则),但4 < 1 为假(根据缺省规则)。

属不合逻辑的Jim。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签