473,327 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

attributes

guy
simple question,
are attributes inherited?
eg if base class is marked serializable are classes that inherit from it
also serializable?
Dec 19 '05 #1
1 1369
guy wrote:
simple question,
are attributes inherited?
eg if base class is marked serializable are classes that inherit from
it also serializable?


Attributes are confusing because some are real attributes (like
[Serializable]) others are custom attributes (that is, they add the
..custom metadata).

In your specific case [Serializable] is not inheritable because the base
class does not know the fields of the child class and so it does not
know whether those are serializable, or whether the client wants them to
be serializable. Only the class itself can know if its fields can be or
should be serialized.

For custom attributes only: each custom attribute is derived from
Attribute and has to have the [AttributeUsage] attribute. This attribute
has a property, Inherited, which indicates if the child class will
inherit the attribute. So if you look up the documentation for a custom
attribute in MSDN you'll see whether it is inheritable or not.

Richard
--
Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
Security Tutorial:
http://www.grimes.demon.co.uk/workshops/securityWS.htm
Dec 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

50
by: Dan Perl | last post by:
There is something with initializing mutable class attributes that I am struggling with. I'll use an example to explain: class Father: attr1=None # this is OK attr2= # this is wrong...
1
by: John L. Clark | last post by:
I am curious as to the rationale, and effect, of having default namespaces not applying (directly) to attributes (see http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute without a...
9
by: Soren Kuula | last post by:
Hi, I just can't find namespaces of attributes stated clearly enough in the XML namespace spec. But .. I hear rumors that attributes, unless qualified otherwise, default to the namespace of the...
7
by: Info 3000 | last post by:
Hello, I'm beginner in XML. I have just a little question : I understand that I can write : <Book> <Title> A nice day </Title> <Author> James Nicepen </Author> </Book>
7
by: John R. | last post by:
How do you set the following file attributes: Compressed Encrypted Normal ReparsePoint SparsePoint You CAN'T set these using FileInfo.Attributes or File.SetAttributes. It doesn't work for...
7
by: localhost | last post by:
What is the best and/or fastest way to enumerate attributes of an HTML control? In my page template, I have: <body id="myBody" bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0"...
3
by: Janaka | last post by:
I've seen and used some samples where you can set the onclick attrubute to a Button control to get it to do some javascript a la : btnUse.Attributes = "DoSomeJS()"; However when i try and get...
2
by: prabhupr | last post by:
Hi Folks I was reading this article (http://www.dotnetbips.com/articles/displayarticle.aspx?id=32) on "Custom Attribute", written by Bipin. The only thing I did not understand in this article...
2
by: james_027 | last post by:
hi everyone, I am now in chapter 5 of Dive Into Python and I have some question about it. From what I understand in the book is you define class attributes & data attributes like this in python...
2
by: cloftis | last post by:
Using VS2003, VB and MSHTML, Using an HTMLSpanElement I want to enumerate the attributes of a SPAN tag. 1 'For testing sake 2 Dim strMarkup as String = "<span attr1='somevalue'...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.