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
System.Diagnostics.Process current = System.Diagnostics.Process.GetCurrentProcess(); | |
DateTime startedTime = current.StartTime; |
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
enum ProgrammingLanguage | |
{ | |
Language_First = 0, | |
CPP = 1, | |
CSharp = 2, | |
Java =3, | |
Language_Last = 4, | |
} | |
class Program | |
{ |
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
private void Tree_BeforeSelect(object sender, TreeViewCancelEventArgs e) | |
{ | |
e.Cancel = IsTreeNodeSelectable(e.Node); | |
} |
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
class C<T> {} | |
internal class D | |
{ | |
public static C<U> M<U>(C<bool> c) | |
{ | |
// Fail compiling: | |
// return (C<U>)c; | |
// Pass compiling, exception in runtime: | |
// return X.Cast<C<U>>(c); |
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
Regex regex = new Regex(@"app"); | |
bool found = false; | |
foreach (var process in Process.GetProcesses()) | |
{ | |
if (regex.Match(process.ProcessName).Success) | |
{ | |
found = true; | |
break; | |
} |
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
Console.WriteLine("CurrentCulture: " + StringComparison.CurrentCulture); | |
Console.WriteLine("InvariantCulture: " + StringComparison.InvariantCulture); | |
Console.WriteLine("Ordinal: " + StringComparison.Ordinal); | |
Console.WriteLine(); | |
const string softhyphen = "\xAD"; | |
const string hyphen = "\x2D"; | |
const string softHyphenPlusHyphen = "\xAD\x2D"; | |
const string hyphenPlusSoftHyphen = "\x2D\xAD"; |
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
Console.WriteLine(System.AppDomain.CurrentDomain.BaseDirectory); | |
Console.WriteLine(System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName)); |
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
public static IEnumerable<Type> GetAssemblyTypes(string filePath) | |
{ | |
Assembly assembly = | |
Assembly.LoadFile(filePath); | |
IEnumerable<Type> types; | |
try | |
{ | |
types = assembly.GetTypes(); | |
} |
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
public static class Extention | |
{ | |
public static bool IsAbstrct(this Type type) | |
{ | |
return type.IsAbstract; | |
} | |
public static bool IsEnumerableType(this Type t) | |
{ | |
return typeof(IEnumerable<string>).IsAssignableFrom(t); |
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
System.Windows.SystemParameters.PrimaryScreenWidth | |
System.Windows.SystemParameters.PrimaryScreenHeigth |
OlderNewer