Skip to content

Instantly share code, notes, and snippets.

@sakapon
Last active September 8, 2018 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakapon/fe8652bdbdcce776cc95be6e701426f3 to your computer and use it in GitHub Desktop.
Save sakapon/fe8652bdbdcce776cc95be6e701426f3 to your computer and use it in GitHub Desktop.
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