Attributes (net1.1) Quick answer needed

S

Steven Nagy

Hi all,

Sorry I have no time to test this myself....

Can I add the same attribute to a field twice?

Eg.

[MyAttr(), MyAttr(), MyAttr()]
Public string myField;


I ask because I would like to use it for interchangable profiles for
datagrid display.

Eg.
[DataGridCol(1, "User Name"), DataGridCol(2, "Login")]
Public string UserName;


Any help would be great, thanks!
I need a quick answer,

Cheers,
Steve
 
F

Frank Rizzo

Re: Attributes (net1.1) Quick answer needed

As opposed to other questions where the posters can wait a week or two.
 
M

Mattias Sjögren

Can I add the same attribute to a field twice?

Yes, if the attribute class has AttributeUsage.AllowMultiple=true


Mattias
 
M

Michael C

Mattias Sjögren said:
Yes, if the attribute class has AttributeUsage.AllowMultiple=true

It probably is better to have one attribute though and pass in an array (I
presume that works?).

Michael
 
?

=?iso-8859-1?Q?Lasse=20V=e5gs=e6ther=20Karlsen?=

Mattias Sjögren said:
It probably is better to have one attribute though and pass in an
array (I presume that works?).

Michael

Again, it should be faster to just test it. Or look in the documentation
for the attribute class in question. In particular, look at the constructors
for the attribute to see what you're allowed to pass.
 
N

Nick Hounsome

Steven Nagy said:
Hi all,

Sorry I have no time to test this myself....

Please reread this and consider how rude it sounds.

Most people who might reply like to consider themselves to be a source of
knowledge and they help out, at least in part, from the not particularly
altruistic feeling of intellectual superiority.

Your post might well be interpreted a implying that you are the intellectual
and knowledgeable equal of anyone replying but that your time is more
valuable.

This may or may not be true but it is not going to endear you to anyone.
 
M

Mattias Sjögren

It probably is better to have one attribute though and pass in an array

Why?


Mattias
 
S

Steven Nagy

Luckily I am not here to make friend heh?

If I was the "the intellectual and knowledgeable equal" of anyone here,
then I probably wouldn't be asking the question.

I like to contribute as much to this community as I can. I like to help
others.
However yesterday I was in a pickle and was not in a position to sit at
a computer with VS on it; I was at a client's office.
I needed to know the answer and was not in a position to find it out
myself.

So here's my advice to you Nick:
Reread your post and consider how rude it was and how many assumptions
you jumped to.
I do consider this forum to be a community since a lot of the same
people return and help others and like to consider myself as part of
that community.
I had no real time to properly explain my situation. It seems to me now
days that people are more interested in finding the faults in other
people's posts rather than just being helpful.

Hopefully you never find yourself in the same position as me Nick
because you may not have anyone to rely on if you act like this with
people you know.

To all the others who answered, many thanks, it did help. It was not a
situation where I could get to any help docs except for MSDN online and
I don't usually frequent that space so it was hard for me to find an
answer.
The attribute in question was actually a custom made attribute.

I am not sure about the array solution but it might also be a
possibility. I am not fantastic at attribute usage and have had trouble
constructing calls to attributes that were any more complex than a few
simple value types.

Once again, thanks to all those who contributed something useful.

Steve
 
M

Michael.Suarez

like it or not, the terms "Sorry I have no time to test this
myself...." and "Quick answer needed" rubbed several people the wrong
way.

I don't believe Nick was rude, nor was he making assumptions... just
pointing out that the way you emphasized your urgency could be taken as
rude... in which case I'd have to agree wholeheartedly.

And your response didn't do much to help your case.

In the future, I'd stick to just asking or answering questions. If you
had left out "Sorry I have no time to test this myself....", "Quick
answer needed", and "I need a quick answer", chances are the question
would have been answered just as quick, and your post wouldnt have
offended anyone.
 
M

Michael C

Lasse Vågsæther Karlsen said:
Again, it should be faster to just test it. Or look in the documentation
for the attribute class in question. In particular, look at the
constructors for the attribute to see what you're allowed to pass.

I'm presuming this is a custom attribute.
 
S

Steven Nagy

Once again, luckily I am not here to make friends heh?

If my simple post requesting haste actually "offended" someone then
that person should perhaps be seeking psychological treatment?
Further, if there was actual offence taken, then those individuals
should speak up and I shall call them personally to apologise.

Personally I think that your statement that I have offended people was
used a little too loosely. If people are going to get worked up over a
simple post like mine then the issue is their's, not mine.

Still, I am sorry to all those I have offended. Please email me
"(e-mail address removed)" and I will call you to apologise in person.

Maybe we can all get together and have a cry about the whole thing?
Loosen up people, life's too short to worry about little stuff like
this. Get over it.
 
M

Michael C

Steven Nagy said:
Once again, luckily I am not here to make friends heh?

If my simple post requesting haste actually "offended" someone then
that person should perhaps be seeking psychological treatment?
Further, if there was actual offence taken, then those individuals
should speak up and I shall call them personally to apologise.

I have to agree with Nick and Michael here. You're initial post was a little
rude and some people pointed that out. You should apologize and move on,
instead of trying desperately to talk your way out of it.
Loosen up people, life's too short to worry about little stuff like
this. Get over it.

I suggest it is you who needs to loosen up and get over it.

Michael
 
S

Steven Nagy

Oh my god, I didn't realise that so many programmers were such whiney
little cry babies.

My post:
Your reply:
You should apologize and move on

What else do you want from me? Have you emailed me your phone number?
I will call you to apologise in person. Make sure you include country
code as I am calling from Australia.
I suggest it is you who needs to loosen up and get over it

I suggest it is time you shut the hell up. You and your little cry baby
friends can all get together and watch a chick flick while eating a
bowl of chocolate ice-cream, crying your eyes out.
If some tiny little statement that wasn't even directed at you can
cause you 'offence' then see previous post regarding seeking help.
Otherwise, try to contribute something useful to the conversation.

Let he who is without sin cast the first stone.
 
M

Michael C

Steven Nagy said:
I suggest it is time you shut the hell up. You and your little cry baby
friends can all get together and watch a chick flick while eating a
bowl of chocolate ice-cream, crying your eyes out.

You do realise the irony here don't you? Every reply to you has been quite
polite and it is *you* who is getting angry and upset yet you are telling us
to chill out, let it go and stop crying.

Michael
 
S

Steven Nagy

What makes you think I am getting upset or angry?
I am interested to know what power you possess that lets you detect my
emotion based on what I type.
Because I am not angry or upset. I am actually quite entertained!
I find this all mildly amusing.
The only reason I keep replying is because you keep making stupid
points.
What other insights do you have to share with the world?
 
M

Michael C

Steven Nagy said:
What makes you think I am getting upset or angry?
I am interested to know what power you possess that lets you detect my
emotion based on what I type.

What you type shows your emotions to some degree at least and you are
certainly upset and angry. If you weren't you would have said right at the
start "Oh I see what you mean, sorry guys". But you really are desperate not
to do that.
Because I am not angry or upset. I am actually quite entertained!
I find this all mildly amusing.
The only reason I keep replying is because you keep making stupid
points.

Irony yet again.

Michael
 
S

Steven Nagy

you are certainly upset and angry

Wow, what university did you get your psychology degree at?
Obviously they are just handing them out...

I probably would have except for a constant barrage of self-indulged
stupid remarks.
But I still can't comprehend how piss weak you all are.
"Oh no, he said something I don't like. I feel so offended... boo hoo"
Give me a break. Are all Americans like you? Shouldn't you be spending
more time oppressing 3rd world countries or something?
 
M

Michael C

Steven Nagy said:
Wow, what university did you get your psychology degree at?
Obviously they are just handing them out...

It don't take no psych degree to work out you're angry and upset.
I probably would have except for a constant barrage of self-indulged
stupid remarks.

Ok, but any remarks came *after* you started scrambling.
But I still can't comprehend how piss weak you all are.
"Oh no, he said something I don't like. I feel so offended... boo hoo"

This is amazing the *you* are saying this. Everyone here was making polite
suggestions, it was you who was too weak to cop those comments on the chin
and got offended. Read back over the posts.
Give me a break. Are all Americans like you? Shouldn't you be spending
more time oppressing 3rd world countries or something?

I'm not an America.

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top