- Published on
C# - 6.0 Auto Property Initializers
Before C# 6
class Test
{
public Guid Id
{
get { return Guid.NewGuid(); }
}
}
C# 6
class Test
{
public Guid Id { get; } = Guid.NewGuid();
}
class Test
{
public Guid Id
{
get { return Guid.NewGuid(); }
}
}
class Test
{
public Guid Id { get; } = Guid.NewGuid();
}