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");
        }
    }
}

Your structure Item contains Status, Title, Series, Author, TYpe and Description. It has a method called Item, but you are using it as a Property in line 47. Not sure what you are trying to do with that line, so can't suggest a fix :)

BTW, it would be helpful if you specified which line was causing the error in the future, so we don't have to hunt for it.

Your structure Item contains Status, Title, Series, Author, TYpe and Description. It has a method called Item, but you are using it as a Property in line 47. Not sure what you are trying to do with that line, so can't suggest a fix :)

BTW, it would be helpful if you specified which line was causing the error in the future, so we don't have to hunt for it.

I apologize. Line 49, Col 23. I believe it is erroring out on the a that I am using for Item. As I followed some coding from Microsoft, I am not sure why it is not working with a.Item.

As I said, your structure doesn't contain an Item property. Whatever code you were following does contain an Item property.

What is that code supposed to do? Why are you checking Item?

As I said, your structure doesn't contain an Item property. Whatever code you were following does contain an Item property.

What is that code supposed to do? Why are you checking Item?

Basically, I am just trying to get the first part of a project completed. I am using the test part to put some books, dvd's, etc in to test the rest. I am trying to use this to display a complete list of those items. After I accomplish this, I will add other things after making it a windows app instead of a console.

After reviewing again, my issue is definately with a.Item. I will try to see if I can figure a way to print the entire list with this statement.

I think I have it now. I added another field that is boolean.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.