Skip to content

Instantly share code, notes, and snippets.

@controlflow
Last active January 1, 2016 01:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save controlflow/8072635 to your computer and use it in GitHub Desktop.
Save controlflow/8072635 to your computer and use it in GitHub Desktop.
Primary ctors
class ReverseForLookupItem : ForLookupItemBase
{
public ReverseForLookupItem([NotNull] PrefixExpressionContext context,
[NotNull] LiveTemplatesManager templatesManager,
[CanBeNull] string lengthPropertyName)
: base("forR", context, templatesManager, lengthPropertyName) { }
protected override IForStatement CreateStatement(CSharpElementFactory factory, ICSharpExpression expression)
{
...
}
}
// vs.
class ReverseForLookupItem([NotNull] PrefixExpressionContext context,
[NotNull] LiveTemplatesManager templatesManager,
[CanBeNull] string lengthPropertyName)
: ForLookupItemBase("forR", context, templatesManager, lengthPropertyName)
{
protected override IForStatement CreateStatement(CSharpElementFactory factory, ICSharpExpression expression)
{
...
}
}
@ViIvanov
Copy link

ViIvanov commented Jan 4, 2014

Кажется, слишком наворочено. Поживём-увидим :о)

@hazzik
Copy link

hazzik commented Apr 8, 2014

@controlflow

Так не работает

class Point(int x, int y) {
  public int X { get { return x; } }
  public int Y { get { return y; } }
}

(7,31): error CS9007: Parameters of a primary constructor can only be accessed in instance variable initializers and arguments to the base constructor.
(8,31): error CS9007: Parameters of a primary constructor can only be accessed in instance variable initializers and arguments to the base constructor.

Последние 3 примера не работают

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment