我写了这段代码,但不知道如何获取length()文件的。我想列出所有大于 50KB 的文件。
public static void main(String[] args) throws IOException {
File f = new File(".");
int KB = 1024;
String[] files = f.list();
for (String string : files) {
if (f.length() > 50*KB)
System.out.println(string);
}
}
Run Code Online (Sandbox Code Playgroud) So after searching for similar questions, I haven't seen any results.
The error that keeps popping up is
Feature 'target-typed conditional expression' is not available in C# 7.3. Please use language version 9.0 or greater.
The code:
.Select(x => new FinancialStatementDto
{
Uid = Guid.NewGuid(),
AccountNumber = x.Key.AccountNumber,
Credit = x.Any(y => y.Credit.HasValue) ? Math.Abs((decimal)x.Sum(y => y.Credit)) : null,
Debit = x.Any(y => y.Debit.HasValue) ? x.Sum(y => y.Debit) : null,
AccountName = x.Key.AccountName
});
Run Code Online (Sandbox Code Playgroud)
The error pops up on
Credit …