$/
artifacts/
build/
docs/
lib/
packages/
samples/
src/
tests/
// a generic wpf boolean value converter class | |
public class GenericBooleanConverter : IValueConverter | |
{ | |
public object TrueValue { get; set; } | |
public object FalseValue { get; set; } | |
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | |
{ | |
return TypeDescriptor.GetConverter(targetType) | |
.ConvertFrom((bool)value ? TrueValue : FalseValue); |
public static string ToUrlSlug(string value){ | |
//First to lower case | |
value = value.ToLowerInvariant(); | |
//Remove all accents | |
var bytes = Encoding.GetEncoding("Cyrillic").GetBytes(value); | |
value = Encoding.ASCII.GetString(bytes); | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
using System.Xml; | |
using System.Xml.Linq; | |
namespace GithubWikiDoc | |
{ |
$ErrorActionPreference = "Stop" | |
$notificationTitle = "Notification: " + [DateTime]::Now.ToShortTimeString() | |
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null | |
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01) | |
#Convert to .NET type for XML manipuration | |
$toastXml = [xml] $template.GetXml() | |
$toastXml.GetElementsByTagName("text").AppendChild($toastXml.CreateTextNode($notificationTitle)) > $null |
################## | |
# Privacy Settings | |
################## | |
# Privacy: Let apps use my advertising ID: Disable | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0 | |
# To Restore: | |
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1 | |
# Privacy: SmartScreen Filter for Store Apps: Disable | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 0 |
### | |
### | |
### UPDATE: For Win 11, I recommend using this tool in place of this script: | |
### https://christitus.com/windows-tool/ | |
### https://github.com/ChrisTitusTech/winutil | |
### https://www.youtube.com/watch?v=6UQZ5oQg8XA | |
### iwr -useb https://christitus.com/win | iex | |
### | |
### |
namespace Analogy | |
{ | |
/// <summary> | |
/// This example shows that a library that needs access to target .NET Standard 1.3 | |
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET | |
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library. | |
/// </summary>INetCoreApp10 | |
class Example1 | |
{ | |
public void Net45Application(INetFramework45 platform) |
############################### | |
# Core EditorConfig Options # | |
############################### | |
root = true | |
# All files | |
[*] | |
indent_style = space | |
# Code files |
Roslyn provides a rich set of APIs for analyzing C# and Visual Basic source code, but constructing a context in which
to perform analysis can be challenging. For simple tasks, creating a Compilation
populated with SyntaxTrees
,
MetadataReferences
and a handful of options may suffice. However, if there are multiple projects involved in the
analysis, it is more complicated because multiple Compilations
need to be created with references between them.
To simplify the construction process. Roslyn provides the Workspace
API, which can be used to model solutions,
projects and documents. The Workspace
API performs all of the heavy lifting needed to parse SyntaxTrees
from source
code, load MetadataReferences
, and construct Compilations
and add references between them.