相关疑难解决方法(0)

您可以在面向.NET 3.5的代码中使用可选参数吗?

我正在寻找一个使用C#4.0新的可选参数功能的库,但我希望将其定位到框架的3.5版本.这可能吗?

可选参数语法糖的方式与扩展方法相同吗?

c# .net-4.0 visual-studio-2010

32
推荐指数
3
解决办法
3万
查看次数

C#上不允许使用默认参数说明符错误

当我构建项目时,VC#表示不允许使用Default参数说明符.它引导我到这个代码:

public class TwitterResponse
{
    private readonly RestResponseBase _response;
    private readonly Exception _exception;

    internal TwitterResponse(RestResponseBase response, Exception exception = null)
    {
        _exception = exception;
        _response = response;
    }
Run Code Online (Sandbox Code Playgroud)

可能是我的错误?

c# .net-3.5 default-parameters

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

C#,不允许使用默认参数说明符

有办法解决这个问题吗?我是新手,我不明白......我试着用其他帖子解决这个问题,但我不知道......

public uint AddAllItemsByDefindex (int defindex, uint numToAdd = 0)
Run Code Online (Sandbox Code Playgroud)

"="符号出现错误"不允许使用默认参数说明符".

如果您需要从代码中了解其他内容以帮助我: 显示编译器错误的开发环境的屏幕截图

c# parameters

-3
推荐指数
1
解决办法
585
查看次数