小编cra*_*157的帖子

如何删除单行语句上的大括号?

谁能建议如何从任何单行语句中删除大括号?(排除明显的手动删除大括号)

在 Visual Studio 中使用 C#。

所以而不是:

if (thingy is null)
{
    throw new ArgumentNullException(nameof(thingy));
}
Run Code Online (Sandbox Code Playgroud)

有替代方案:

if (thingy is null)
    throw new ArgumentNullException(nameof(thingy));
Run Code Online (Sandbox Code Playgroud)

我尝试运行 CodeMaid 并更改 CodeCleanup (这只是将其更改回大括号)。我很高兴尝试任何推荐的扩展等来解决这个问题。

c# code-cleanup curly-braces visual-studio codemaid

5
推荐指数
2
解决办法
2551
查看次数

可选的 <Integer> 不能转换为 Int(用于 GUI 进度条)

当我尝试在 JProgressBar 上设置值时,我收到以下错误。

"Optional 不能转换为 Int"

有人可以建议任何解决方法/解决方案吗?

public GUI(){
    initComponents();
    tL = new TasksToDo();
    jProgressBar1.setValue(tL.retrieveTotalHours());// [Where my error occurs]}
}  
Run Code Online (Sandbox Code Playgroud)

从 TaskToDo 类中,最初我将其设置为 ArrayList 但警告说需要切换到 Optional:

  public class TasksToDo {

    public static ArrayList<Task> taskList;

    public TasksToDo(){
        taskList = new ArrayList<Task>();
        taskList.add(new Task(0,"Whitepaper", "Write first draft of Whitepaper",  7));
        taskList.add(new Task(1,"Create Database Structure", "Plan required fields and tables",  1));
        taskList.add(new Task(2,"Setup ODBC Connections", "Create the ODBC Connections between SVR1 to DEV-SVR",  2));

    }

    public void addTask (int taskId, String taskTitle, String …
Run Code Online (Sandbox Code Playgroud)

java swing stream jprogressbar optional

3
推荐指数
2
解决办法
6096
查看次数