https://www.microsoft.com/net/download/dotnet-framework-runtime
public static string GetTimestamp()
{
return DateTime.Now.ToString("HH':'mm':'ss.fff");
}
public static string GetDateTimestamp()
{
return DateTime.Now.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.fff");
}
Stopwatch stopwatch = Stopwatch.StartNew();
/* do stuff */
double elapsedSec = (double)stopwatch.ElapsedTicks / Stopwatch.Frequency;
string message = $"{elapsedSec * 1000:0.00} ms ({1 / elapsedSec:0.00} Hz)";
- format document:
CTRL+K
,CTRL+D
- format selection:
CTRL+K
,CTRL+F
- comment:
CTRL+K
,CTRL+C
- uncomment:
CTRL+K
,CTRL+U
- full screen:
ALT+SHIFT+ENTER
comboChannel.Enabled = (channelCount > 1) ? true : false;
// manual way
if (lineStyle == null)
this.lineStyle = new Styles.Line();
else
this.lineStyle = lineStyle;
// inline if statement
this.lineStyle = (lineStyle == null) ? new Styles.Line() : lineStyle;
// null coalescing operator
this.lineStyle = lineStyle ?? new Styles.Line();
If you are sure it will parse:
int.Parse(string)
If you are not sure it will parse:
int i;
bool success = int.TryParse(string, out i);
Color randomColor = Color.FromArgb(255, rand.Next(256), rand.Next(256), rand.Next(256));
public Color randomColor { get { return Color.FromArgb(255, rand.Next(256), rand.Next(256), rand.Next(256)); } }