小编Was*_*ama的帖子

找不到命令“ dotnet ef”?

我在Arch VScode上使用.NET Core 2.0,并尝试使EF工具正常工作,但我不断收到该错误“找不到命令dotnet ef”。我只是到处看,所有建议都没有。因此,如果可以的话,请您提供帮助。

运行“ dotnet ef”的结果

[wasiim@wasiim-PC WebApiServerApp]$ dotnet ef --help
Cannot find command 'dotnet ef', please run the following command to install

dotnet tool install --global dotnet-ef
[wasiim@wasiim-PC WebApiServerApp]$ dotnet tool list -g
Package Id            Version      Commands        
---------------------------------------------------
dotnet-dev-certs      2.2.0        dotnet-dev-certs
dotnet-ef             2.2.3        dotnet-ef       
[wasiim@wasiim-PC WebApiServerApp]$ 
Run Code Online (Sandbox Code Playgroud)

这是dotnet --info结果,如果有帮助的话

[wasiim@wasiim-PC WebApiServerApp]$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.2.105
 Commit:    7cecb35b92

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /opt/dotnet/sdk/2.2.105/ …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework csproj .net-core asp.net-core

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

const指向不符合预期的指针

运行时为什么会出错?我期待ptr_ref无法修改ptr指向的地址,但事情似乎没有按计划进行.

int b = 3;
int* ptr = &b;
//says something about cannot convert int* to type const int*&
const int*& ptr_ref = ptr; 
Run Code Online (Sandbox Code Playgroud)

在此先感谢,15岁的C++ noob

c++ pointers visual-c++

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

“enumType”和“TEnum”之间的区别

这里是 C# 的新手。我正在通过enum方法浏览MSDN ,但我无法区分TEnumenumType.

public static bool TryParse<TEnum>(
string value,
out TEnum result)

public static string[] GetNames(
Type enumType)
Run Code Online (Sandbox Code Playgroud)

这里有什么区别?对于第一种方法,返回enumType result不是更好吗?

c# msdn visual-studio-2010 visual-studio

5
推荐指数
1
解决办法
4268
查看次数

char*[]元素每个占用4个字节,char []每个占用1个字节?

为什么以下代码的输出是这样的?

char str[] = {'i', 't', 'i', 's', 'm', 'e', '\0'}; //this code equates to 7 bytes
char* str[] = {'i', 't', 'i', 's', 'm', 'e', '\0'}; //this code equates to 28 bytes
Run Code Online (Sandbox Code Playgroud)

c arrays pointers

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

岩纸剪刀胜率不起作用?

计算机和播放器的赢率始终为0%或100%,我不知道为什么.我已经逐步完成了这个问题,似乎没有任何问题,但它没有像我期望的那样工作,因此必定存在某些问题.

abstract class Participant
{
    public int wins;
    float _winRate;

    protected float winRate {
        get
        {
            return _winRate;
        }
        set 
        {
            if (value < 0 || value > 100) 
            {
                throw new Exception("value cannot be less than 0 or greater than 100");
            }
            _winRate = value;
        }
    }
    public void PrintWinRate()
    {
        winRate = (wins / Game_Info.gamesPlayed) * 100;
        string _winRate = "win rate: " + winRate.ToString() + "%";
        Console.WriteLine(_winRate.PadLeft(0));
    }

    public abstract string Choice();
}

class Computer:Participant
{
    string[] …
Run Code Online (Sandbox Code Playgroud)

c# visual-studio-2010 visual-studio

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

我为什么要使用枚举而不是字符串?

为什么这是"良好的编码实践"?例如,当我制作Rock Paper Scissors控制台游戏时,大多数人建议使用枚举而不是字符串.有什么不同?

c# enums

-1
推荐指数
1
解决办法
1476
查看次数

在视觉工作室恼人的灰色块

我工作在vs当我编辑代码有时光标变成一个恼人的灰色块,基本上很难编辑任何东西我将如何摆脱这种麻烦?

灰色块:http: //i.stack.imgur.com/kiSBR.png

c# visual-studio-2010

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