Hello everyone/anyone.
This is my first post anywhere on the internet .But I've spent years reading them trying to learn varios things. I read on an MSDN forum that its appropriate to ask after 2hours of trying or something like that,But that would be many times a day for me so i'l try to limit it.
My point is I mean well, and any well meaning advice such as (you're asking questions to often!) or (Less preamble get to the point!) and particularly how I could contribute, with my very basic computer abilities , is really appreciated.

first some code

static void Main(string[] args)
        Person Michael = new Person();
        Person Mary = new Person();

        // Specify some values for the instance variables
        Michael.Age = 20;
        Michael.HairColor = "Brown";
        Michael.Ocupation = "Teacher";
        Mary.Age = 25;
        Mary.HairColor = "Black";
        Mary.Ocupation = "nurse";
        Console.WriteLine("Please enter a new persons name to add , and press enter:");

        Person (Console.ReadLine()) = new Person();

error:ConsoleApplication1.Person is a 'type 'but used like a 'variable'

Why is the last line not acceptable?.Intuitivly i've always tried to do that. What is the simplest alternative (that actully works :))?.

Edited by Reverend Jim: Fixed formatting

7 Years
Discussion Span
Last Post by ddanbe

Hi welcome on DANIWEB!

Person Michael = new Person(Console.ReadLine());
But then you must have a constructor in your class Person that accepts a string: Person(string Name);

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.