Monday

csharp binary operators sample

1. declaring values to be masked : all must be pow2

public enum EnumInvoiceFlags
{
LateFeeApplied = 1,
DelinquencyApplied = 2,
Unfreezed = 4
}


applying masks:
 invoice.Flags = invoice.Flags | (int)EnumInvoiceFlags.DelinquencyApplied; 



checking if mask has specific value:
 
if ((invoice.Flags & (int)EnumInvoiceFlags.DelinquencyApplied) != (int)EnumInvoiceFlags.DelinquencyApplied)



No comments:

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...