标签一组成员为私有/公共的C# [英] labeling a group of members as private/public in c#
本文介绍了标签一组成员为私有/公共的C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在C ++类的声明,可以标记一个组成员的私人或公共,如:
in a c++ class declaration, you can label a group of members as private or public, e.g.
private:
int x;
double y;
好像没有办法在C#中做到这一点。我错了?
seems like there's no way to do this in c#. am I wrong?
推荐答案
没有,你不能这样做在C#。
No, you can't not do this in C#.
目前最好的,你可以使用成员默认可见性,这是私人的,而不是使用私有,但对于公众,你必须表明它的所有成员。
At best, you can use the default visibility for members, which is private, and not use private, but for public, you have to indicate it for all members.
这篇关于标签一组成员为私有/公共的C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文