印仔 发布的文章

//为属性设置默认值的两种方式
// by 鸟哥
using System;

public class Tree{

public int Height{get;set;}=10;

private string color="green";
public string Color{
    get{
        return color;
    }
    set{
        color=value;
    }
}

}

public class Test
{

public static void Main()
{
    Tree tree=new Tree();
    
    Console.WriteLine("Height:"+tree.Height);
    Console.WriteLine("Color:"+tree.Color);
}

}

运行结果:

Height:10
Color:green
————————————————
版权声明:本文为CSDN博主「鸟哥01」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sinat_18811413/article/details/120438417

需要改变RemoteSigned的执行策略。具体操作如下:

1、win10搜索 Windos PowerShell 管理员权限打开 (不是cmd,切记!)

2、设置权限

执行如下命令:

set-ExecutionPolicy RemoteSigned
选择Y即可!

3、查询

输入以下命令查看当前的执行策略权限状态。

get-ExecutionPolicy
如果是RemoteSigned,则已修改成功。

from
https://www.fujieace.com/computer-practical/about_execution_policies.html