How do I create a class item with properties?

From: mb (mm_at_hotmail.com)
Date: 09/24/04


Date: Thu, 23 Sep 2004 20:31:11 -0600

Here is an example of what I want to create:

A class called Cars

public class Cars
{
    public string Mazda;
    public string Ford;
  etc, etc..........
}

then I want to create properties for each car so if I instantiate Cars:

Cars myCar = new Cars();

then I can access this:

myCar.Mazda.Wheels = Color.Black

I hope this makes sense.

Thanks

PS. I want to randomly pick a car and have its Wheel property checked.



Relevant Pages

  • Re: Serialization of a custom collection
    ... it seems I'll have to create a "wrapper" ... public class CarCollection: List ... public string Model; ... CarCollection cars = GetCars; ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: web service error - urgent
    ... What about this instead (return an array of Cars): ... Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) ... public string make; ...
    (microsoft.public.dotnet.framework.webservices)
  • RE: web service error - urgent
    ... What is "ports" anyway? ... What about this instead (return an array of Cars): ... Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) ... public string make; ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Datagrid and switch
    ... public string ConvertFieldType(int fieldTypeId){ ... > If it is a 1 it must show cars. ... > If it is a 2 is must show bikes. ...
    (microsoft.public.dotnet.framework.aspnet)
  • What am I doing wrong?
    ... Form1 has code that creates a type "Cars" ... I instantiate an array of type Test with properties ... and says "Object reference not set to an instance of an object" ...
    (microsoft.public.dotnet.general)