c# using directive depth

Viewed 862

I'm trying to understand the c# using directive...Why does this work...

using System;
using System.ComponentModel.DataAnnotations;
namespace BusinessRuleDemo
{
    class MyBusinessClass
    {
        [Required]
        public string SomeRequiredProperty { get; set; }
    }
}

but this does not?

using System;
using System.ComponentModel;
namespace BusinessRuleDemo
{
    class MyBusinessClass
    {
        [DataAnnotations.Required]
        public string SomeRequiredProperty { get; set; }
    }
}

The second results in a compile error "The type or namespace DataAnnotations cannot be found. Are you missing are missing a using directive or an assembly reference?

2 Answers
Related