Last active
September 8, 2018 13:52
-
-
Save sakapon/fe8652bdbdcce776cc95be6e701426f3 to your computer and use it in GitHub Desktop.
TextTemplateSample/RecordGenConsole/Program.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
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; | |
} | |
} |
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
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