Stock Management: Step 1

Let us summarize using .NET classes with a sample program, which manages the stock of a small store. The program supports three commands:

  • add: adds new item to stock

  • quit: exit program

  • help: show help

If a user chooses to add an item, he or she is asked to enter a name for a new item. Our program generates a new id, and we build a string in the following format:

<id> <item_name>

Afterwards, we capitalize all first letters of words in the item name and store the information. To make our program more ambitious, the stock information is stored in the text file Stock.txt. To perform the file output operations, we introduce another .NET class: StreamWriter. We construct the StreamWriter object and pass to its constructor ...

Get Programming PERL in the .NET Environment now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.