Results 1 to 2 of 2

Thread: Custom Attribute

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Answers
    1

    Custom Attribute

    What's wrong with the following code?

    [Tracker("CR-0001", "Cow Boy", FixDescription = "Some cow boy job", ChangeDate = DateTime.Now)]
    class TrackerTester
    {
    }
    [AttributeUsage(AttributeTargets.All, AllowMultiple=true, Inherited=true)]
    class TrackerAttribute : Attribute
    {
    private string problemId;
    private string engineerId;

    public string FixDescription { set; get;}
    public DateTime ChangeDate { set; get; }

    public TrackerAttribute()
    {
    problemId = "Unassigned";
    engineerId = "Unidentified Engineer";
    }

    public TrackerAttribute(string problemId, string engineerId)
    {
    this.problemId = problemId;
    this.engineerId = engineerId;
    }
    }


  2. #2
    Junior Member
    Join Date
    Nov 2007
    Answers
    24

    Re: Custom Attribute

    Hi in the following code you have to define public readonly propertsies for problemId,engineerId
    Then the code will work.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact