If you want to keep your data after the program finishes you need some kind of data store (database or document).
But if you don't care for keeping data you can achieve what you ask with DataTable class.
var myTable = new DataTable("Product");
var productidColumn = new DataColumn("ProductId", typeof(int));
productidColumn.AutoIncrement = true;
myTable.Columns.Add(productidColumn);
Then you can manipulate with data as you please.
Also you can go a step further and create typed dataset or code first EF repository.
There are many ready solutions for your requirement, last thing I would do is to make own custom auto-increment mechanism.
It is possible and simple, but it is also as reinventing the wheel (and prone to bugs in case of beginners!).