Ace Frahm Ace Frahm - 1 year ago 82
C# Question

Are These Square Brackets Indicating An Indexer?

public class Task : IBusinessEntity
public Task () {}

[PrimaryKey, AutoIncrement]
public int ID { get; set; }

public string Name { get; set; }
public string Notes { get; set; }
public bool Done { get; set; }

Is the
[PrimaryKey, AutoIncrement]
an indexer in C#?

This code is made to work with SQLlite-NET.

Would the index be defined in
or whatever that inherits from?

Answer Source

They are called attributes.

Here is the documentation from Microsoft, and here is a tutorial about them.

You can declare them at a class level like this (code from MSDN tutorial):

public class HelpAttribute : System.Attribute 

Or at a method-level:

public void SomeWebMethod([System.Web.Services.WebMethod(
   Description="Describe what your method does here.")])

Or, at the member-level like you have already declared above. Happy coding!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download