Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9108095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:43:52+00:00 2026-06-17T02:43:52+00:00

I get this problem but don’t know how to fix it. I don’t like

  • 0

I get this problem but don’t know how to fix it. I don’t like to change namespace. This is my code:

namespace ParlayRMS.Models.System
{
    using System;
    using System.Globalization;

    public class MaintenanceInfo
    {
        public MaintenanceInfo()
        {
            IsDownTime = false;
            TimeFrom = DateTime.Now.ToString(CultureInfo.InvariantCulture);
            TimeTo = DateTime.Now.ToString(CultureInfo.InvariantCulture);
        }
        public bool IsDownTime { get; set; }
        public string TimeFrom { get; set; }
        public string TimeTo { get; set; }
    }
}

This class causes error: “Type or namespace ‘DateTime’ could not be found.” because this class is put in namespace System which same as with .NET Framework. If I change “ParlayRMS.Models.System” to “ParlayRMS.Models”, this class will be ok but I don’t like this way. I need a solution for this case without changing many codes.

THanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:43:53+00:00Added an answer on June 17, 2026 at 2:43 am

    The System in using System.Globalization is referring to you namespace, so it should be another compile error there.

    If you really like the usings within the namespace (a practice that I, personally, dislike), you should use the global:: extern alias (I think that’s what it’s called)

    namespace ParlayRMS.Models.System
    {
        using global::System;
        using global::System.Globalization;
    
        public class MaintenanceInfo
        {
            public MaintenanceInfo()
            {
                IsDownTime = false;
                TimeFrom = DateTime.Now.ToString(CultureInfo.InvariantCulture);
                TimeTo = DateTime.Now.ToString(CultureInfo.InvariantCulture);
            }
            public bool IsDownTime { get; set; }
            public string TimeFrom { get; set; }
            public string TimeTo { get; set; }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Forgive me if this is a dumb beginners problem, but I really don't get
Ok, so this seems like a really silly problem but I can't get my
I have this problem that I probably understand but don't know how to handle,
This is a stupid problem, but I can't seem to get around it. I
This is a very old problem, but I cannot seem to get my head
I get this problem when referring to OpenFEC (openfec.org)-functions in my code: anders@ubuntu:~/workspace/fectest$ gcc
I have looked at other questions regarding this problem but the solutions don't work
I try to get this code running. I am almost there but I got
I have a little Problem but don't know the Solution! I have wrote a
I have been trying to fix this problem but not been able to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.