//构造函数注入 public ApplePhone(IMicrophone microphone) { Microphone = microphone; WriteLineWithColor($"构造函数注入{microphone.GetType().Name}类型"); Id = Guid.NewGuid().ToString(); Console.WriteLine($"ApplePhone 被构造,Id:{Id}"); }
public ApplePhone(IMicrophone microphone) { Microphone = microphone; WriteLineWithColor($"构造函数注入{microphone.GetType().Name}类型"); }