zoukankan      html  css  js  c++  java
  • VS csproj设置

    手动关联xaml与cs文件

    复用其他控件,添加现有项时无法关联

        <Compile Include="ControlsUC_Loading.xaml.cs">
          <DependentUpon>UC_Loading.xaml</DependentUpon>
        </Compile>
    

    启用可空引用

    启用 C# 8.0 的语法支持
    在项目文件中开启可空引用类型的支持

    定义 说明 备注
    string aa 不可为空 aa就是不可为空的引用类型
    string? aa 可为空 aa就是可为空的引用类型
    method(string aa) 未知 对于类型参数来说,可能不能确定是否是可空引用类型
    static void Main(string[] args)
    {
        Test(null);;
    }
    
    #nullable enable
    readonly static string? _name = null;
    private static void Test(string name)
    {
        int len = name.Length;
        int len2 = _name.Length + len;
    }
    #nullable disable
    

    len2 计算时会提示 _name可能为null

    显示引用次数

  • 相关阅读:
    字典
    列表
    重要的方法
    一笔"狗"销,"猪"事顺利!!!
    基础数据类型
    循环,格式化,运算符
    算法——三角形图形
    算法——字母金字塔
    算法——二进制求和
    Python power函数
  • 原文地址:https://www.cnblogs.com/wesson2019-blog/p/14186394.html
Copyright © 2011-2022 走看看