This file contains hidden or 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
[ExportCodeFixProvider(DiagnosticAnalyzer.DiagnosticId, LanguageNames.CSharp)] | |
internal class CodeFixProvider : ICodeFixProvider | |
{ | |
public IEnumerable<string> GetFixableDiagnosticIds() | |
{ | |
return new[] { DiagnosticAnalyzer.DiagnosticId }; | |
} | |
public async Task<IEnumerable<CodeAction>> GetFixesAsync(Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) | |
{ |
This file contains hidden or 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
[DiagnosticAnalyzer] | |
[ExportDiagnosticAnalyzer(DiagnosticId, LanguageNames.CSharp)] | |
public class DiagnosticAnalyzer : ISyntaxTreeAnalyzer | |
{ | |
internal const string DiagnosticId = "EndOfFile"; | |
internal const string Description = "No blank lines at the end of the file please."; | |
internal const string MessageFormat = "No blank lines at the end of the file please."; | |
internal const string Category = "Naming"; | |
internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Description, MessageFormat, Category, DiagnosticSeverity.Warning); |
This file contains hidden or 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 Program | |
{ | |
static void Main(string[] args) | |
{ | |
Random rand = new Random(); | |
var currentInt = 0; | |
int[] tasks = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; // Should have used F#. | |
Parallel.ForEach(tasks, (x) => |
This file contains hidden or 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
[ExportCodeFixProvider(DiagnosticAnalyzer.DiagnosticId, LanguageNames.CSharp)] | |
internal class CodeFixProvider : ICodeFixProvider | |
{ | |
public IEnumerable<string> GetFixableDiagnosticIds() | |
{ | |
return new[] { DiagnosticAnalyzer.DiagnosticId }; | |
} | |
public async Task<IEnumerable<CodeAction>> GetFixesAsync(Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) | |
{ |
This file contains hidden or 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
^!g:: | |
TypeLib := ComObjCreate("Scriptlet.TypeLib") | |
NewGUID := TypeLib.Guid | |
clipboard = %NewGUID% | |
Send ^v |
This file contains hidden or 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
[DiagnosticAnalyzer] | |
[ExportDiagnosticAnalyzer(DiagnosticId, LanguageNames.CSharp)] | |
public class DiagnosticAnalyzer : ISyntaxNodeAnalyzer<SyntaxKind> | |
{ | |
internal const string DiagnosticId = "DoNotThrowCaughtException"; | |
internal const string Description = "Do not throw back a caught exception like this."; | |
internal const string MessageFormat = "Really? REALLY?!"; | |
internal const string Category = "Usage"; | |
internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Description, MessageFormat, Category, DiagnosticSeverity.Warning); |
This file contains hidden or 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
var stereotype = StereotypeBuilder.Build() | |
.WithStereotypes(c => | |
{ | |
c.RegisterStereotype<Product>(s => s.RegisterGenerator<Guid>((existingValue) => Guid.NewGuid()) | |
.RegisterGenerator<int>((existingValue) => StandardGenerators.Current.GenerateInt())); | |
}); | |
var list = new List<Product>(); | |
for (int i = 0; i < 2000; i++) |