Click here to Skip to main content
15,920,801 members
Home / Discussions / C#
   

C#

 
AnswerRe: Exceptions Pin
PIEBALDconsult8-Nov-07 15:33
mvePIEBALDconsult8-Nov-07 15:33 
QuestionHow to get a window's icon, WM_GETICON indeed. Pin
Anthony Mushrow8-Nov-07 6:48
professionalAnthony Mushrow8-Nov-07 6:48 
AnswerRe: How to get a window's icon, WM_GETICON indeed. Pin
Giorgi Dalakishvili8-Nov-07 7:00
mentorGiorgi Dalakishvili8-Nov-07 7:00 
GeneralRe: How to get a window's icon, WM_GETICON indeed. Pin
Anthony Mushrow8-Nov-07 7:44
professionalAnthony Mushrow8-Nov-07 7:44 
GeneralRe: How to get a window's icon, WM_GETICON indeed. Pin
Giorgi Dalakishvili8-Nov-07 8:08
mentorGiorgi Dalakishvili8-Nov-07 8:08 
QuestionFilter Graphs Pin
GrizzlyDoug8-Nov-07 6:19
GrizzlyDoug8-Nov-07 6:19 
AnswerRe: Filter Graphs Pin
Rich Insley8-Nov-07 9:59
Rich Insley8-Nov-07 9:59 
QuestionAttributes giving problem Pin
humayunlalzad8-Nov-07 5:57
humayunlalzad8-Nov-07 5:57 
In the following code snippet myMath class has five Attributes, the problem which I am facing is that on the console I don't get the Order of the Attributes , right. The attribute with bugID = 1 shows on the top, and strangely it is followed by the fifth attribute bugID = 5, and then 2,3,4.
When I remove the fifth Attribute this is the order of the Attributes 2,1,3,4.
When there are three attributes the behavior is normal as in 1,2,3.
When there are two attributes again the behavior changes to 2,1.
Can Anyone pl. figure out the problem for me
  using System.Collections.Generic;
using System;
using System.Linq;
using System.Text;
using System.Reflection;

namespace UsingAttributes
{
    [AttributeUsage(AttributeTargets.All,AllowMultiple = true  )]
    class BugFixAttribute : Attribute
    {
        private int bugID;
        private string coder;
        private string date;
        private string comment;
        public BugFixAttribute(int bugID, string coder, string date)
        {
            this.bugID = bugID;
            this.coder = coder;
            this.date = date;
        }

        public string Comment
        {
            get
            {
                return comment;
            }
            set
            {
                comment = value;
            }
        }
        public int BugID
        {
            get
            {
                return bugID;
            }
        }

        public string Coder
        {
            get
            {
                return coder;
            }
        }

        public string Date
        {
            get
            {
                return date;
            }
        }
    }
    [BugFix(001, "sh", "08/11/2007", Comment = "one")]
    [BugFix(002, "sh", "08/11/2007", Comment = "two")]
    [BugFix(003, "sh", "08/11/2007", Comment = "three")]
    [BugFix(004, "sh", "08/11/2007", Comment = "four")]
    [BugFix(005, "sh", "08/11/2007", Comment = "five")]
    public class myMath
    {
        public double DoFunc1(double param1)
        {
            return param1 + DoFunc2(param1);
        }

        public double DoFunc2(double param1)
        {
            return param1 / 3;
        }
    }
    class Program
    {
       
        
        static void Main(string[] args)
        {
            myMath mm = new myMath();
            Console.WriteLine("Result for DoFunc(7) = {0}", mm.DoFunc1(7));

            MemberInfo   inf = typeof(myMath);
            object[] attributes = inf.GetCustomAttributes(typeof(BugFixAttribute), false);
            foreach (object attribute in attributes)
            {
                BugFixAttribute b = attribute as BugFixAttribute;
                Console.WriteLine("\nBugID: {0}", b.BugID);
                Console.WriteLine("Programmer: {0}", b.Coder);
                Console.WriteLine("Date : {0}", b.Date);
                Console.WriteLine("Comment: {0}", b.Comment);
            }
            Console.ReadKey();
        }
    }
}



Thanx
AnswerRe: Attributes giving problem Pin
J4amieC8-Nov-07 6:18
J4amieC8-Nov-07 6:18 
AnswerRe: Attributes giving problem Pin
Pete O'Hanlon8-Nov-07 9:11
mvePete O'Hanlon8-Nov-07 9:11 
AnswerRe: Attributes giving problem [modified] Pin
PIEBALDconsult8-Nov-07 15:37
mvePIEBALDconsult8-Nov-07 15:37 
GeneralRe: Attributes giving problem Pin
PIEBALDconsult8-Nov-07 16:58
mvePIEBALDconsult8-Nov-07 16:58 
AnswerRe: Attributes giving problem Pin
Nissim Salomon9-Nov-07 0:15
Nissim Salomon9-Nov-07 0:15 
QuestionHow to Send Parameter(s) to Reporting Service ? Pin
hdv2128-Nov-07 4:34
hdv2128-Nov-07 4:34 
AnswerRe: How to Send Parameter(s) to Reporting Service ? Pin
Giorgi Dalakishvili8-Nov-07 6:23
mentorGiorgi Dalakishvili8-Nov-07 6:23 
GeneralRe: How to Send Parameter(s) to Reporting Service ? Pin
hdv2128-Nov-07 11:32
hdv2128-Nov-07 11:32 
GeneralRe: How to Send Parameter(s) to Reporting Service ? Pin
Giorgi Dalakishvili8-Nov-07 20:15
mentorGiorgi Dalakishvili8-Nov-07 20:15 
QuestionXML Deserialisation & Malformed XML [modified] Pin
MrEyes8-Nov-07 4:23
MrEyes8-Nov-07 4:23 
AnswerRe: XML Deserialisation & Malformed XML Pin
MrEyes8-Nov-07 4:58
MrEyes8-Nov-07 4:58 
GeneralRe: XML Deserialisation & Malformed XML Pin
J4amieC8-Nov-07 6:14
J4amieC8-Nov-07 6:14 
GeneralRe: XML Deserialisation & Malformed XML Pin
MrEyes8-Nov-07 6:49
MrEyes8-Nov-07 6:49 
Questionshow/hide detection Pin
Morad SAJID8-Nov-07 3:36
Morad SAJID8-Nov-07 3:36 
AnswerRe: show/hide detection Pin
Pete O'Hanlon8-Nov-07 3:40
mvePete O'Hanlon8-Nov-07 3:40 
GeneralRe: show/hide detection Pin
Morad SAJID8-Nov-07 4:13
Morad SAJID8-Nov-07 4:13 
GeneralRe: show/hide detection Pin
AliAmjad8-Nov-07 4:20
AliAmjad8-Nov-07 4:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.