The type or namespace name 'Notes' could not be found

Peter_1985 2,736 Reputation points
2023-09-16T06:33:54.24+00:00

Hi,

How to resolve such issue, to the line below?

using Notes.Models;

Developer technologies | .NET | Xamarin
Developer technologies | Visual Studio | Other
Developer technologies | C#
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,126 Reputation points Microsoft External Staff
    2023-09-20T02:04:50.9133333+00:00

    Hello,

    namespace name 'Notes' could not be found

    For this issue, please refer to Compiler Error CS0246 for more details.

    For your question, I noticed that you commented using Notes.Models;.

    If you have already created the Note class in Notes.Models, please uncomment it.

    If you don't want to use Using Namespace at the beginning, replace Note in your code with Notes.Models.Note.

    According to the project you provided, you did not create the Note class in this project.

    1. Right-click to create a Note class file in the project and add the following code to the file.
    using System;
    using SQLite;
    
    namespace Notes.Models
    {
        public class Note
        {
            [PrimaryKey, AutoIncrement]
            public int ID { get; set; }
            public string Text { get; set; }
            public DateTime Date { get; set; }
        }
    }
    
    1. Reference namespaces in NoteDatabase.cs.
    using Notes.Models;
    
    

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


2 additional answers

Sort by: Most helpful
  1. Olaf Helper 47,441 Reputation points
    2023-09-18T06:09:03.43+00:00

    using Notes.Models;

    Read the example completely and foloow it step-by-step.

    The Namespace using Notes.Models is defined in the project.


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.