-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare JetBrains.Annotations samples #16
- added sample of [SourceTemplate]
- Loading branch information
1 parent
7816d24
commit aa72ca7
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
Synergy.Contracts.Samples/Annotations/SourceTemplateAttributeSample.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using JetBrains.Annotations; | ||
|
||
namespace Synergy.Contracts.Samples.Annotations | ||
{ | ||
public static class SourceTemplateAttributeSample | ||
{ | ||
[SourceTemplate] | ||
public static void forEach<T>(this IEnumerable<T> xs) | ||
{ | ||
foreach (T x in xs) | ||
{ | ||
//$ $END$ | ||
} | ||
} | ||
|
||
[SourceTemplate] | ||
public static void newGuid(this object obj, [Macro(Expression = "guid()", Editable = -1)] string newguid) | ||
{ | ||
Console.WriteLine("$newguid$"); | ||
} | ||
|
||
private static void test() | ||
{ | ||
var enumerable = new List<string>(); | ||
|
||
//enumerable.forEach | ||
//enumerable.newGuid | ||
|
||
string s = null; | ||
//s.fi | ||
} | ||
} | ||
} |