模式命名CLS兼容替代属性 [英] Pattern for naming CLS compatible alternative Properties

查看:130
本文介绍了模式命名CLS兼容替代属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有这样的属性。

  [CLSCompliant(假)]
公共UINT东西{...}
 

和想写一个选择,我不能只写过载,我会做的方法。 但是我应该如何命名?有没有在.NET库的一些通用的方式?

 众长SomethingAlternative {...}
 

解决方案

我会建议 SomethingAsInt64 明确表示行为的差异。

If i have a property like this

[CLSCompliant(false)]
public uint Something { ... }

and want to write an alternative, i can not just write an overload as i would do for methods. But how should i name it? Is there some general way in the .NET libs?

public long SomethingAlternative { ... }

解决方案

I would suggest SomethingAsInt64 to explicitly indicate the behavioural difference.

这篇关于模式命名CLS兼容替代属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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