none
how to solve this prolem RRS feed

  • Question

  • Error 1 'subject': member names cannot be the same as their enclosing type C:\Users\CORE\Documents\Visual Studio 2012
    Sunday, March 11, 2018 10:42 AM

Answers

  • Seems that you have a class called subject that includes a member (data or function) which is called subject too. Use a different name for this member. If it is a constructor, then do not specify the return type.

    Show some details.

    Sunday, March 11, 2018 1:22 PM

All replies

  • Error 1 'subject': member names cannot be the same as their enclosing type C:\Users\CORE\Documents\Visual Studio 2012
    Sunday, March 11, 2018 10:43 AM
  • Seems that you have a class called subject that includes a member (data or function) which is called subject too. Use a different name for this member. If it is a constructor, then do not specify the return type.

    Show some details.

    Sunday, March 11, 2018 1:22 PM
  • Hi Abdalmonem Elbrbary,

    Continuing from Viorel's answer, you did not provide any code snippet to point out where you are going wrong. To help you more to understand you can look into below article how to resolve name conflict issue. Hope this will help you.

    Resolve "Member Name Cannot Be the Same as Enclosing Type" Error

    Compiler Error CS0542


    Thanks,
    Sabah Shariq

    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or click Answered "Vote as helpful" button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]

    Sunday, March 11, 2018 2:24 PM
    Moderator
  • Here are some guidelines for the future.

    Make the subject (title) of your posts something we can use to determine whether we should look at the question. If you always say something like "how to solve this prolem" then people that might be able to help might not look at the question. Don't try to ask the entire question in the subject but do provide some help in deciding whether to look at it.

    Always provide the entire error message except for the path to the files. The error number is not shown here.

    Always provide the relevant code, when there is code relevant to the problem. Try not to show too much, however; just show the relevant part(s).



    Sam Hobbs
    SimpleSamples.Info

    Sunday, March 11, 2018 9:55 PM