Code to generate number sequence in class using MSD axapta

Code to generate number sequence in class using axapta x++

Assign number sequence from parameter table

 numberSeq = NumberSeq::newGetNumFromCode(LedgerParameters::numRefJournalNum().NumberSequence, true, true);  
 //put value of number sequence to variable this way.  
  voucher = NumberSeq::newGetNumFromCode(ledgerJournalName.VoucherSeries, true,  true).num();