Created
April 27, 2021 17:13
-
-
Save manoj-choudhari-git/e95af39b67b0cc18c1cf890a5f3af4fa to your computer and use it in GitHub Desktop.
The service for demonstrating delayed instantiation using .NET dependency injection mechanism
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ICreatedOnDateTimeService.cs | |
public interface ICreatedOnDateTimeService | |
{ | |
public DateTime CreatedOn { get; set; } | |
} | |
// CreatedOnDateTimeService.cs | |
public class CreatedOnDateTimeService : ICreatedOnDateTimeService | |
{ | |
private readonly DateTime createdOn; | |
public CreatedOnDateTimeService() | |
{ | |
createdOn = DateTime.Now; | |
} | |
public DateTime CreatedOn { get => createdOn; set => throw new NotImplementedException(); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment