谁能建议如何从任何单行语句中删除大括号?(排除明显的手动删除大括号)
在 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 (这只是将其更改回大括号)。我很高兴尝试任何推荐的扩展等来解决这个问题。
当我尝试在 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) c# ×1
code-cleanup ×1
codemaid ×1
curly-braces ×1
java ×1
jprogressbar ×1
optional ×1
stream ×1
swing ×1