最近看到代碼中有語法糖,記錄一下,ide
1.重寫,只能重寫,屬性,虛方法(virtual),子類重寫用override對象
private string a
public string A
{
get =>「123」;
set =>a=value;
}get
2.定義靜態變量賦值
private static Lazy<KafkaProducer> Producer { get; } = new Lazy<KafkaProducer>(() => new KafkaProducer(_kafkaConfigDic), true);kafka
靜態屬性,類初始化就會執行string
3.給引用的對象區別名
using Common.Logging;
using Tuhu.WinService.ConsumerForPush.Kafka;
using System;
using System.Threading.Tasks;
using KafkaMessage = Confluent.Kafka.Message<Confluent.Kafka.Null, string>;變量