小编Boj*_*ski的帖子

如何列出大于给定参数的所有文件?

我写了这段代码,但不知道如何获取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)

java file list

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

Convert decimal? to decimal in earlier versions of .NET (C# Version 7.3)

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 …

c# decimal type-conversion c#-7.3

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

标签 统计

c# ×1

c#-7.3 ×1

decimal ×1

file ×1

java ×1

list ×1

type-conversion ×1