Simple Product Database in C#.NET

If you are looking for a Simple Product Databases you are at the right place to deal with it. This tutorial will help you how to create a simple database in C#. This projects creates a list of data such as product name and product price. I have a sample code below.

Sample Code

Product Database Script
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. public class SimpleProductDatabase
  7. {
  8. public static void Main()
  9. {
  10. List<string> list = new List<string>();
  11. list.Add("Pizza Republic: P500");
  12. list.Add("Greenoz Pizza: P500");
  13. list.Add("Shakey's Pizza: P500");
  14. list.Add("Greenwhich Pizza: P500");
  15. list.Add("Yellow Cab Pizza: P500");
  16. for(int n = 0; n < list.Count; n++)
  17. {
  18. string[] substring = list[n].Split(':');
  19. for(int x = 0; x < substring.Length -1; x++)
  20. {
  21. Console.WriteLine("Product Name : " + substring[0] + "Price - " + substring[1]);
  22. }
  23. }
  24. }
  25. }
For the Project.json
  1. {
  2. "version": "1.0.0-*",
  3. "buildOptions": {
  4. "emitEntryPoint": true
  5. },
  6. "dependencies": {
  7. "Microsoft.NETCore.App": {
  8. "version": "1.0.0-rc2-3002702"
  9. }
  10. },
  11. "frameworks": {
  12. "netcoreapp1.0": {
  13. "imports": "dnxcore50"
  14. }
  15. },
  16. "runtimes" : {
  17. "win7-x86" : {}
  18. }
  19. }
Result Hope that this tutorial will help you a lot and thanks for reading this tutorial. Don't forget to Like & Share This site www.sourcecodester.com

Add new comment