简体   繁体   English

Visual Studio c# 错误 CS7036 方法调用

[英]Visual Studio c# Error CS7036 Method Call

I keep getting the CS7036 error in Visual Studio and I cant figure out how to correct it.我在 Visual Studio 中不断收到 CS7036 错误,我不知道如何纠正它。 the error code CS7306 occurs in the eROISImport.GenerateRport();错误代码 CS7306 出现在 eROISImport.GenerateRport() 中; call.称呼。 I'm not sure what parameters it wants since in the GenerateReport method creation at the top the parameters are defined.我不确定它需要什么参数,因为在顶部的 GenerateReport 方法创建中定义了参数。 I have tried to define the parameter in the eROISIMPORT.GenerateReport but it is not accepted when I use the totalApplied or any others parameters that are defined in the GenerateReport method.我试图在 eROISIMPORT.GenerateReport 中定义参数,但是当我使用 totalApplied 或 GenerateReport 方法中定义的任何其他参数时,它不被接受。 Another issue I get is in the GenerateReport method I get the CS0051 Inconsistent accessibility parameter type List.我得到的另一个问题是在 GenerateReport 方法中,我得到 CS0051 Inconsistent 可访问性参数类型列表。 This error occurred when I changed private static to public void.当我将私有静态更改为公共无效时发生此错误。 I appreciate any help with this.我很感激这方面的任何帮助。

 public void GenerateReport(int totalUnknown, int totalApplied, int totalAccepted, int totalRejected, int totalDropped, int totalTesting, int totalNonCompliance, int totalNoncompliance8453, int totalNoncomplianceFieldMonitoring, int totalRevoked, List<DataInput>dataInputList)   

    public static Main(string[] args)
    {
        EROIRSImport eROIRSImport = new EROIRSImport();


        eROIRSImport.ImportFile(args);
        eROIRSImport.GenerateReport();

I get the CS0051 Inconsistent accessibility parameter type List<DataInput> .我得到 CS0051 Inconsistent 可访问性参数类型List<DataInput>
This error occurred when I changed private static to public void当我将private static更改为public void时发生此错误

That means DataInput isn't public .这意味着DataInput不是public

A method can't expose (as a parameter or a return type) a type that is less accessible than the method itself, because consuming code won't be able to use the method if they can't know the types it exposes.方法不能公开(作为参数或返回类型)比方法本身更难访问的类型,因为如果消费代码不知道它公开的类型,他们将无法使用该方法。

Either change DataInput to also be public or change the accessibility of the method to match the accessibility of DataInput .要么将DataInput更改为也是public的,要么更改方法的可访问性以匹配DataInput的可访问性。 ( internal ? private ?) internalprivate ?)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM