小编Ilu*_*tar的帖子

使用scanf读取行或打破特殊字符

是否可以使用scanf()读取文本行 - 排除\n和中断特殊(选定)字符,但包含该字符

这是我目前的表达方式:while(scanf("%49[^:\n]%*c", x)==1) 但这个排除了:.是否有可能打破阅读:但也读这个角色?

c scanf

6
推荐指数
1
解决办法
861
查看次数

C# 自己的布尔类通过引用传递 bool

是否可以以某种方式使用此类(test.Value 不是我正在寻找的):

RefBool test = false;
if (test)
{

}
Run Code Online (Sandbox Code Playgroud)

这是类主体:

public class RefBool
{
    public bool Value { get; set; }
    public RefBool(bool value)
    {
        this.Value = value;
    }

    public static implicit operator RefBool(bool val)
    {
        return new RefBool(val);
    }

}
Run Code Online (Sandbox Code Playgroud)

c# boolean ref

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

如何正确使方法异步?

我有计算Levenshtein距离的方法

public static LevenshteinMatches LevenshteinSingleThread(this string str, string expression, int maxDistance) {
        if (str.Length > expression.Length + 1) {
            int len = expression.Length;
            long strLen = str.Length - len + 1;
            int[] results = new int[strLen];
            int[][,] dimension = new int[strLen][,];
            for (int i = 0; i < strLen; i++) {
                dimension[i] = new int[len + 1, len + 1];
            }

            string source = str;
            source = source.ToUpper();
            expression = expression.ToUpper();

            for (int i = 0; i < strLen; i++) …
Run Code Online (Sandbox Code Playgroud)

c# asynchronous async-await

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

标签 统计

c# ×2

async-await ×1

asynchronous ×1

boolean ×1

c ×1

ref ×1

scanf ×1