TextTemplateSample/RecordGenConsole/Program.cs
using System; | |
using System.Text; | |
namespace RecordGenConsole | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var person = new Person(4, "Shiro", DateTime.UtcNow, null, Encoding.UTF8); | |
var n = new Number(3, 2.5, DayOfWeek.Sunday); | |
Console.WriteLine(n.Scaled); // 7.5 | |
} | |
} | |
public partial class Number | |
{ | |
public double Scaled => (Scale ?? 1) * N; | |
} | |
} |
using System; | |
namespace RecordGenConsole | |
{ | |
public partial class Person | |
{ | |
public int Id { get; } | |
public string Name { get; } | |
public DateTime Birthday { get; } | |
public Uri Uri { get; } | |
public System.Text.Encoding Encoding { get; } | |
public Person(int id, string name, DateTime birthday, Uri uri, System.Text.Encoding encoding) | |
{ | |
Id = id; | |
Name = name; | |
Birthday = birthday; | |
Uri = uri; | |
Encoding = encoding; | |
} | |
} | |
public partial class Empty | |
{ | |
public Empty() | |
{ | |
} | |
} | |
public partial class Number | |
{ | |
public int N { get; } | |
public double? Scale { get; } | |
public DayOfWeek DayOfWeek { get; } | |
public Number(int n, double? scale, DayOfWeek dayOfWeek) | |
{ | |
N = n; | |
Scale = scale; | |
DayOfWeek = dayOfWeek; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment