By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,993 Members | 1,947 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,993 IT Pros & Developers. It's quick & easy.

Difference between [RunInstaller(true)] and [RunInstallerAttribute(true)]

P: n/a
I can't find any good information on the
relation/difference between
[RunInstaller(true)] and [RunInstallerAttribute(true)]
attributes in the code. Please advise.

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Sep 3 '08 #1
Share this Question
Share on Google+
8 Replies


P: n/a
K Viltersten <tm**@viltersten.comwrote:
I can't find any good information on the
relation/difference between
[RunInstaller(true)] and [RunInstallerAttribute(true)]
attributes in the code. Please advise.
Almost no difference at all. From the C# 3.0 spec, section 17.2:

<quote>
By convention, attribute classes are named with a suffix of Attribute.
An attribute-name of the form type-name may either include or omit this
suffix. If an attribute class is found both with and without this
suffix, an ambiguity is present, and a compile-time error results. If
the attribute-name is spelled such that its right-most identifier is a
verbatim identifier (§2.4.2), then only an attribute without a suffix
is matched, thus enabling such an ambiguity to be resolved.
</quote>

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Sep 3 '08 #2

P: n/a
I can't find any good information on the
relation/difference between
[RunInstaller(true)] and [RunInstallerAttribute(true)]
attributes in the code. Please advise.
Almost no difference at all. From the C# 3.0 spec, section 17.2:

<quote>
By convention, attribute classes are named with a suffix of Attribute.
An attribute-name of the form type-name may either include or omit this
suffix. If an attribute class is found both with and without this
suffix, an ambiguity is present, and a compile-time error results. If
the attribute-name is spelled such that its right-most identifier is a
verbatim identifier (§2.4.2), then only an attribute without a suffix
is matched, thus enabling such an ambiguity to be resolved.
</quote>

Great info. Thanks!

For some reason VS2005 will suggest the name
sans the suffix when using autogenerated code.
i almost got punched today for using the
suffix while a colleague insisted on not to.

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Sep 3 '08 #3

P: n/a
K Viltersten <tm**@viltersten.comwrote:
Great info. Thanks!

For some reason VS2005 will suggest the name
sans the suffix when using autogenerated code.
i almost got punched today for using the
suffix while a colleague insisted on not to.
I think omitting the suffix is idiomatic - I certainly don't include it
myself.

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Sep 3 '08 #4

P: n/a
K Viltersten wrote:
>I can't find any good information on the
relation/difference between
[RunInstaller(true)] and [RunInstallerAttribute(true)]
attributes in the code. Please advise.
For some reason VS2005 will suggest the name
sans the suffix when using autogenerated code.
i almost got punched today for using the
suffix while a colleague insisted on not to.
VS and your colleague are right. If you write
FoobarAttribute, then you will have all the maintainers
of your code searching for FoobarAttributeAttribute !

Arne

Sep 4 '08 #5

P: n/a
"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:48***********************@news.sunsite.dk...
>For some reason VS2005 will suggest the name
sans the suffix when using autogenerated code.
i almost got punched today for using the
suffix while a colleague insisted on not to.

VS and your colleague are right. If you write
FoobarAttribute, then you will have all the maintainers
of your code searching for FoobarAttributeAttribute !
Oh yes, XmlAttributeAttribute certainly did teach us that sort of thing,
didn't it... :)
Sep 4 '08 #6

P: n/a
>>I can't find any good information on the
>>relation/difference between
[RunInstaller(true)] and [RunInstallerAttribute(true)]
attributes in the code. Please advise.
>For some reason VS2005 will suggest the name
sans the suffix when using autogenerated code.
i almost got punched today for using the
suffix while a colleague insisted on not to.

VS and your colleague are right. If you write
FoobarAttribute, then you will have all the maintainers
of your code searching for FoobarAttributeAttribute !
How can we explain that the code provided by
MS on in the help uses the suffix, then? Is
it a mistake? A special case? Please advise.

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Sep 4 '08 #7

P: n/a
"K Viltersten" <tm**@viltersten.comwrote in message
news:6i************@mid.individual.net...
How can we explain that the code provided by
MS on in the help uses the suffix, then? Is
it a mistake? A special case? Please advise.
It is _allowed_ to both provide and omit the suffix, so it's not a mistake.
On the other hand, Microsoft samples in MSDN have never been particularly
good as far as coding style is concerned - they often don't even follow
Microsoft's own style guide. Overall, vast majority of hand-written C# code
I've seen omits the suffix - after all, that was why it is allowed to do so
in the first place.
Sep 4 '08 #8

P: n/a
>How can we explain that the code provided by
>MS on in the help uses the suffix, then? Is
it a mistake? A special case? Please advise.

It is _allowed_ to both provide and omit the suffix, so it's not a
mistake. On the other hand, Microsoft samples in MSDN have never been
particularly good as far as coding style is concerned...
Got it. Thanks!

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Sep 4 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.