From aa72ca7af5e1cafb209b051723c28678fddc8943 Mon Sep 17 00:00:00 2001 From: "marcin.celej" Date: Thu, 13 Oct 2016 14:31:26 +0200 Subject: [PATCH] Prepare JetBrains.Annotations samples #16 - added sample of [SourceTemplate] --- .../SourceTemplateAttributeSample.cs | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Synergy.Contracts.Samples/Annotations/SourceTemplateAttributeSample.cs diff --git a/Synergy.Contracts.Samples/Annotations/SourceTemplateAttributeSample.cs b/Synergy.Contracts.Samples/Annotations/SourceTemplateAttributeSample.cs new file mode 100644 index 0000000..75bd131 --- /dev/null +++ b/Synergy.Contracts.Samples/Annotations/SourceTemplateAttributeSample.cs @@ -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(this IEnumerable 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(); + + //enumerable.forEach + //enumerable.newGuid + + string s = null; + //s.fi + } + } +} \ No newline at end of file