September 2002
Intermediate to advanced
496 pages
10h
English
We conclude this survival guide with a somewhat larger example that illustrates the concepts we have already discussed and also introduces a few additional features of C#. Our example is a version of the Stock Management System that we have used as a case study throughout the second part of this book. The sample code is in the folder StockManager.
The file StockDefs.cs defines an enumeration, a structure, and an interface that are used in the system.
// StockDefs.cs
using System.Collections;
public enum ItemStatus : byte
{
NotFound, // 0 implicitly
NotEnough, // 1 implicitly
Ok = 5 // explicit value
}
public struct StockItemStruct
{
public int Id;
public string Name;
public int Count;
}
public interface IStock { int AddItem(string ...Read now
Unlock full access