小编Arc*_*co3的帖子

PyCharm 不愿意导入模块

每当我尝试在 PyCharm 中导入模块时,代码行都会以灰色突出显示,并给出错误“未使用的导入语句”。我尝试导入的每个模块似乎都会发生这种情况。有谁知道是什么原因造成的?

pycharm python-2.7

6
推荐指数
2
解决办法
2万
查看次数

.net Core 中的 .ConfigureKestrel() 方法存在问题

我正在尝试使用 .net Core 创建一个非常简单的 API,并正在探索 Kestrel。我按照本 MS 教程的说明进行操作:https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel ?view=aspnetcore-2.2

但是,当我尝试调用ConfigureKestrel方法时,Visual Studio告诉我“IWebHostBuilder不包含'ConfigureKestrel()'的定义,并且找不到接受'IWebHostBuilder'类型的第一个参数的ConfigureKestrel的可访问扩展方法(您是否缺少 using 指令或程序集引用?)”

我找不到这方面的任何信息,而且我相当确定我使用的是正确的库。任何帮助将不胜感激 - 代码包括:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace WebApplication2
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateWebHostBuilder(args).Build().Run();

        }

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
        WebHost.CreateDefaultBuilder(args)
        .UseStartup<Startup>()
        .ConfigureKestrel((context, options) =>
        {
            // Error with ConfigureKestrel method above
        });
    }
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net kestrel

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

在 C++ 函数中返回两种不同类型的两个值

我正在编写一个程序,该程序对从用户输入获取的字符串执行简单的旋转(类似于 rot13)。我的问题是,我想每次将字符串的 ASCII 值中的每个字符更改不同的量 - 因此我使用 for 循环来遍历字符串,并调用每次生成随机数的函数。但是,我希望能够返回这个数字,以便我可以在以后“解读”该字符串。显然,我还需要返回字符串。

这是我的代码:

int ranFunction()
{

    int number = rand() % 31;
    return number;

}

string rotFunction(string words)
{
    int upper_A = 65;
    int lower_z = 122;
    int rand_int = 0;

    for (int i = 0; i < words.length(); i++)
    {
        rand_int = ranFunction();

        if (words[i] >= upper_A && words[i] <= lower_z) {

            words[i] -= rand_int;


        }

    }
    return words; 
}
Run Code Online (Sandbox Code Playgroud)

我希望 rotFunction 返回单词和一个基于 rand_int 每次发生的整数。

请注意:我使用的数字 RE: ascii 值等现在完全是任意的,只是用于测试。

c++ return function

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

标签 统计

asp.net ×1

c# ×1

c++ ×1

function ×1

kestrel ×1

pycharm ×1

python-2.7 ×1

return ×1