zoukankan      html  css  js  c++  java
  • [转]MVC 经验总结_序

      <appSettings>
        <add key="vs:EnableBrowserLink" value="false"/>
      </appSettings>

    加入以上代码,用于禁用 MVC 默认的 Visual Studio Browser Link
    来自:https://blog.csdn.net/zhuyu19911016520/article/details/51952790

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                // 可变类型
                // var 是类型推断
                var i = 10;
                Console.WriteLine(i.GetType().ToString());
                // dynamic 是弱类型
                dynamic j = 10;
                Console.WriteLine(j.GetType().ToString());
                j = "abc";
                Console.WriteLine(j.GetType().ToString());
    
                // 对象初始化器
                var p1 = new Person() { Name = "对象初始化器" };
                Console.WriteLine(p1.Name);
    
                // 集合初始化器
                var p2 = new List<Person>() { 
                    new Person(){ Name = "A" },
                    new Person(){ Name = "B" }
                };
    
                // 匿名类型
                var p3 = new { Name = "匿名类型" };
                Console.WriteLine(p3.GetType().ToString());
    
                // 扩展属性
                p1.Say("Hello,World!");
                // 委托 和 实现
                p1.MyAdd = Add1;
                // 通常看到的事件的写法如下
                //p1.MyAdd += Add1;
                // 调用没有方法的委托会报错
                Console.WriteLine(p1.MyAdd(1, 2));
    
                // 匿名委托
                p1.MyAdd += delegate(int a, int b) { return a + b * 2; };
                Console.WriteLine(p1.MyAdd(1, 2));
    
                // lambda 表达式
                p1.MyAdd = (x, y) => x * 2 - y;
                Console.WriteLine(p1.MyAdd(3, 5));
    
                p1.MyAdd2 = () => 5;
                Console.WriteLine(p1.MyAdd2());
    
                Console.ReadKey();
            }
    
            private static int Add1(int a, int b)
            {
                return a + b;
            }
        }
    
        // 自动属性
        public class Person
        {
            public string Name { get; set; }
    
            public Add MyAdd;
    
            public Add2 MyAdd2;
        }
        // 扩展属性
        public static class PersonEx
        {
            public static void Say(this Person p, string str)
            {
                Console.WriteLine(p.Name + " Say : " + str);
            }
        }
        // 委托
        public delegate int Add(int a, int b);
        public delegate int Add2();
    }

     网站预加载:https://www.cnblogs.com/teamblog/p/6195078.html

  • 相关阅读:
    彻底理解Hive中的锁
    Hive中的UDF详解
    如何让你的SQL运行得更快
    软件需求评审之五个案例和九条建议
    数据结构算法大全
    SQL Server CPU时间和占用时间及优化
    SQL Server datetime数据类型设计、优化误区
    SQL Server CASE语句中关于Null的处理
    UML分析设计顺序
    OO软件设计说明书结构
  • 原文地址:https://www.cnblogs.com/z5337/p/5245521.html
Copyright © 2011-2022 走看看