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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Management; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Check(); |
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
namespace RestartManagerWrapper | |
{ | |
using System; | |
public static class OsVersion | |
{ | |
private static readonly Version ver = Environment.OSVersion.Version; | |
/// <summary> | |
/// Whether OS is Windows Vista or newer |
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
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using System.Windows.Media.Imaging; | |
/// <summary> | |
/// Edit Exif metadata. | |
/// </summary> |
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 const int countThreshold = 64; | |
public static IEnumerable<TSource> MergeSort<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) | |
{ | |
if (source == null) | |
throw new ArgumentNullException("source"); | |
var countFull = source.Count(); | |
if (countFull < countThreshold) | |
return source.OrderBy(keySelector); |
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
using System; | |
using System.Runtime.InteropServices; | |
using System.Windows.Media; | |
public static class WindowsEightChromeColor | |
{ | |
public static Color? GetChromeColor() | |
{ | |
bool isEnabled; | |
var hr1 = DwmIsCompositionEnabled(out isEnabled); |
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 VisualTreeHelperAddition | |
{ | |
public static IEnumerable<T> GetDescendents<T>(this DependencyObject parent) where T : DependencyObject | |
{ | |
if (parent == null) | |
yield break; | |
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++) | |
{ | |
var child = VisualTreeHelper.GetChild(parent, i); |
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
using System; | |
using System.Runtime.InteropServices; | |
using System.Windows; | |
using System.Windows.Interactivity; | |
using System.Windows.Interop; | |
using System.Windows.Media; | |
public class PerMonitorDpiBehavior : Behavior<Window> | |
{ | |
protected override void OnAttached() |
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
using System; | |
using System.Runtime.InteropServices; | |
using System.Windows; | |
using System.Windows.Interop; | |
using System.Windows.Media; | |
public class PerMonitorDpiProperty : DependencyObject | |
{ | |
public static PerMonitorDpiProperty GetAttachedProperty(DependencyObject obj) | |
{ |
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 void TestMethod(IEnumerable<string> names) | |
{ | |
List<string> nameList = names as List<string> ?? names.ToList(); //OK | |
int nameCount = (names as List<string> ?? names.ToList()).Count; //OK | |
//Case 1 | |
nameList.ForEach(x => Console.WriteLine(x)); //OK | |
//Case 2 | |
(names as List<string> ?? names.ToList()).ForEach(x => Console.WriteLine(x)); //OK |
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
namespace System.Runtime.CompilerServices | |
{ | |
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] | |
public class CallerMemberNameAttribute : Attribute | |
{ | |
} | |
} |
OlderNewer