Last active
July 24, 2020 12:18
-
-
Save Mrsevic/05ce7e9d702a647fe5b217b6e580018e to your computer and use it in GitHub Desktop.
LazyInitializer
This file contains hidden or 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
protected static readonly Lazy<int> CONST_LUNGHEZZA_SSCC_WITH_CONTROL_CHARACTER = new Lazy<int>(() => CONST_LUNGHEZZA_SSCC + 2); //2 per i caratteri di controllo (00) + 18 per | |
// singleton | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
private Program() | |
{ | |
} | |
private static readonly System.Lazy<Program> _instance = new System.Lazy<Program>(() => new Program()); | |
public static Program Instance => _instance.Value; | |
static void Main(string[] args) | |
{ | |
var self = Program.Instance; | |
Console.WriteLine("Hello World!"); | |
} | |
} | |
} | |
// private static readonly Lazy<List<PianificazioneTrasferimentoDto>> _pianificazioniDatiFitiziInstance = new Lazy<List<PianificazioneTrasferimentoDto>>(() => | |
new List<PianificazioneTrasferimentoDto>() | |
{ | |
new PianificazioneTrasferimentoDto { | |
ArticoloCodice = (344543).ToString(), | |
ArticoloDescrizione = "CONF. JAM 1 x 1", | |
ConformazioneDescrizione = "1 - 9x7", | |
Lotto = "2001_02/07/2001", | |
UnitaDiMisura = "KG", | |
NoUdcPreviste = 0, | |
}, | |
public static List<PianificazioneTrasferimentoDto> DatiFitizziInstance => _pianificazioniDatiFitiziInstance.Value; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment