I am getting an error when trying to build. Error is that ReneApp.Item does not contain a definition for Item and no extension method 'Item' accepting a first argument could be found. Any assistance would be greatly appreciated. I am new to C3 and this is my first try at a program.
using System;
using System.Collections;
using System.Linq;
using System.Text;
namespace ReneApp
{
// Describes an item in the list:
public struct Item
{
public string Status; // Status of the item.
public string Title; // Title of the item.
public string Series; // Series the item is in.
public string Author; // Author of the item.
public string Type; // Type of item.
public string Description; // Description of item.
public Item(string status, string title, string series, string author, string type, string description)
{
Status = status;
Title = title;
Series = series;
Author = author;
Type = type;
Description = description;
}
}
// Declare a type to process an item:
public delegate void ProcessItemDelegate(Item item);
// Maintains an item database.
public class ItemDB
{
// List of all items in the database:
ArrayList list = new ArrayList();
// Add an item to the database:
public void AddItem(string status, string title, string series, string author, string type, string description)
{
list.Add(new Item(status, title, series, author, type, description));
}
// Process items:
public void ProcessItem(ProcessItemDelegate processItem)
{
foreach (Item z in list)
{
if (z.Item)
processItem(z);
}
}
}
}
// Using the Item class:
namespace ItemTestClient
{
using ReneApp;
class View
{
// Print the title of the item.
static void PrintTitle(Item z)
{
Console.WriteLine(" {0}", z.Title);
}
// Execution starts here.
static void Main()
{
ItemDB itemDB = new ItemDB();
// Initialize the database with some items:
AddItems(itemDB);
// Print all the titles of items:
Console.WriteLine("Item Titles:");
// Create a new delegate object associated with the static
// method Test.PrintTitle:
itemDB.ProcessItem(new ProcessItemDelegate(PrintTitle));
}
// Initialize the item database with some test items:
static void AddItems(ItemDB itemDB)
{
itemDB.AddItem("Stock", "Dark Rival", "Masters of Time", "Brenda Joyce", "Book", "Time Travel");
itemDB.AddItem("Stock", "Dark Prince", "Dark Series", "Christine Feehan", "Book", " ");
itemDB.AddItem("Stock", "Shadow Game", "Ghost Walker", "Christine Feehan", "Book", " ");
itemDB.AddItem("Stock", "The Quest", " ", "Lindsay McKenna", "Book", " ");
itemDB.AddItem("Stock", "Rush Hour", "Rush Hour", "Jackie Chan", "Movie", "Action-Comedy");
itemDB.AddItem("Stock", "The Long Kiss Goodnight", " ", "Samuel Jackson", "Movie", "Action");
itemDB.AddItem("Stock", "Under Siege 2", "Under Siege", "Steven Seagal", "Movie", "Action");
itemDB.AddItem("Stock", "Hostage", " ", "Bruce Willis", "Movie", "Action");
itemDB.AddItem("Stock", "Tales of the Abyss", " ", " ", "Game", "Order of Lorelei");
itemDB.AddItem("Loan", "The Curse of the Black Pearl", "Pirates of the Caribbean", "Johnny Depp", "Movie", " ");
itemDB.AddItem("Wishlist", "Hidden Currents", "Drake Sisters", "Christine Feehan", "Book", "Book 7");
}
}
}