p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 (http://p2p.wrox.com/forumdisplay.php?f=400)
-   -   Build Error Chapter 19 RegistrationInformation (http://p2p.wrox.com/showthread.php?t=80790)

RobIOC September 2nd, 2010 11:19 AM

Build Error Chapter 19 RegistrationInformation
 
I seemed to have either entered incorrectly or misinterpreted instructions

public class RegistrationInformation
{
public RegistrationInformation()
{

}
public struct RegistrationInformation
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string SelectedEvent { get; set; }
}
}

this yields an error on the struct "member names cannot be the same as their enclosing type."

Help would be appreciated.Thanks.

RobIOC September 2nd, 2010 11:27 AM

Sorry
 
Sorry guys I should have checked the download code first.

I realise now it was supposed to be just the struct.
Thanks

Antiaaa February 19th, 2014 01:02 AM

Hi,I meet the same problem,I want to know how you solve it

mmorgan30 March 25th, 2014 01:09 AM

Well Antiaaa, you have 1 of 2 choices to resolve this issue
1) define a class named RegistrationInformation
2) define a struct named RegistrationInformation

you cant have both either in the same namespace or defined with each other.

Code:


public struct RegistrationInformation
{
    public string FirstName { get; set; }
    .
    .
    .
}

or
Code:

public class RegistrationInformation
{
    public string FirstName { get; set; }
    .
    .
    .
}



All times are GMT -4. The time now is 03:59 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.