小编Bur*_*rst的帖子

Visual Studio Code 中是否有 GhostDoc 的类似物?

我正在寻找类似 GhostDoc for VS Code (C#) 的东西,但没有成功。有谁知道什么吗?

我只找到了一个“旧的”类似 VS 的扩展,它使 XML 注释在您键入“///”时可用,但这不是我正在寻找的。

code-documentation visual-studio-code

9
推荐指数
1
解决办法
2148
查看次数

在 C# 中,Relfection 错误地确定了 ByRef 方法参数的 IsGenericType 属性

有人可以解释为什么我看到我所看到的(下面控制台的屏幕截图)?对于 'ref' 和非 'ref' 方法参数,我从 Reflection 获得了不同的泛型相关属性。我正在使用 .NET 4.8(经典的 .NET Framework)。

public class MyClass {

    public class Aref
    {
        public virtual void method(object je, ref List<MyClass> batchlist, object doc)
        {
        }
    }


    public class A
    {
        public virtual void method(object je, List<MyClass> batchlist, object doc)
        {
        }
    }

    private static void WriteGenericProps(Type type)
    {
        var method = type.GetMethod(nameof(Aref.method));
        var param = method.GetParameters().First(p => p.Name == "batchlist");

        Console.WriteLine(nameof(param.ParameterType.IsByRef) + "=" + param.ParameterType.IsByRef);
        Console.WriteLine(nameof(param.ParameterType.IsGenericType) + "=" + param.ParameterType.IsGenericType);
        Console.WriteLine(nameof(param.ParameterType.ContainsGenericParameters) + "=" + …
Run Code Online (Sandbox Code Playgroud)

.net c# generics reflection

1
推荐指数
1
解决办法
53
查看次数