English 中文(简体)
视觉演播室 类别中的方法名称清单
原标题:Visual studio List of method names in a class

我知道下一份名单,即“SHOWS”除了别的某类方法外,还有许多方法,但我正在编制一个流程图,因此,我需要一个“list>,作为“>,在某一类中所有方法的。 我如何获得这一名单,因为目前我正在人工复制方法名称,使之成为一个非常麻烦的清单,因为我有600种方法......

最佳回答
问题回答

我不知道,自欧佩组织提出这一问题以来,情况是否发生了变化,但比较容易,即采用“级观点”(Ctrl-Shift-C)。 现在,这一解决办法允许按字母顺序检索某级的所有方法,在“级观点”中点击适当的类别,然后点照相。

既然不是整个项目,只针对个别班级,如果你有600个班级,每个班有1种方法,那么我会说,如果每个班有合理的方法分配,那么就不应该是坏。

你们可以进行思考,了解所有方法、财产等清单,然后将其写出来,以便列入档案。

举例来说,如果你想要在某类人群中找到所有公开的静态方法,你会这样做:

// get all public static methods of MyClass type
MethodInfo[] methodInfos = typeof(MyClass).GetMethods(BindingFlags.Public |
                                                      BindingFlags.Static);
// sort methods by name
Array.Sort(methodInfos,
        delegate(MethodInfo methodInfo1, MethodInfo methodInfo2)
        { return methodInfo1.Name.CompareTo(methodInfo2.Name); });

// write method names
foreach (MethodInfo methodInfo in methodInfos)
{
  Console.WriteLine(methodInfo.Name);
}

反省是一种办法,使系统可以暂时查询这些物体所暴露的物体类型及方法和特性。

在你看来,你并不只想一切公开和静态的方法,而是一切方法。 因此,你将对上述法典作适当的修改,以便做到这一点。

当事方极为晚,但这是没有遵守守则的一种方式。





相关问题
building .net applications without Visual Studio

I m interested to hear about people working with building .net applications using MSBuild, NAnt or similar tools. What are you using, why are you using it instead of the VS IDE? I like to use ...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Visual Studio 2010 Beta 2: Can I print in color?

I have to turn in a hard copy of some code with an assignment. Is there any way in Visual Studio 2010 to print C# source code with syntax highlighting? PS: The assignment is solving a math problem, ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

WPF design-time context menu

I am trying to create a custom wpf control, I m wondering how I can add some design-time features. I ve googled and can t seem to get to my goal. So here s my simple question, how can I add an entry ...