C# Vocabulary

G

Gordon Padwick

As a newcomer to C# and WPF I'm having much difficulty understanding
terminology. I come across such terms as "Dependency Property" and need to
know what that term means. The help file in Visual Studio 2008 contains much
information about Dependency Properties, but doesn't tell me what a
dependency property is. Likewise, the several books about C# and WPF I have
contain information about dependency properties, but don't tell me what a
dependency property is.

Can someone give me, in two or three sentences, an explanation of what a
dependeny propery is?

I find it very frustrating that book authors refer to terms without
adequately defining the meaning of those terms. All books should include
definitions of terms, preferably in a glossary or, lacking that, by
including those terms in an index that refers the reader to the place in the
text where the term is defined.

Gordon Padwick
 
P

Pavel Minaev

As a newcomer to C# and WPF I'm having much difficulty understanding
terminology. I come across such terms as "Dependency Property" and need to
know what that term means. The help file in Visual Studio 2008 contains much
information about Dependency Properties, but doesn't tell me what a
dependency property is. Likewise, the several books about C# and WPF I have
contain information about dependency properties, but don't tell me what a
dependency property is.

Can someone give me, in two or three sentences, an explanation of what a
dependeny propery is?

Sure. A dependency property is a property implemented using
DependencyProperty class. :)

That's really all there is to it. There no specific theory behind it,
that's why there's no "proper" definition.

From this definition follows that dependency properties are strictly a
WPF feature, and have nothing to do with C# specifically.
 
C

Chris Nahr

As a newcomer to C# and WPF I'm having much difficulty understanding
terminology. I come across such terms as "Dependency Property" and need to
know what that term means. The help file in Visual Studio 2008 contains much
information about Dependency Properties, but doesn't tell me what a
dependency property is. Likewise, the several books about C# and WPF I have
contain information about dependency properties, but don't tell me what a
dependency property is.

These can't be very good books! Dependency properties are a core WPF
concept, and any decent WPF books should explain them. Try Adam
Nathan, "Windows Presentation Foundation Unleashed", which is very
good despite being published by Sams.

I also recommend that you get a strong footing with C# itself before
moving into WPF -- it's a very complex framework with plenty of its
own higher-level concepts.
 
G

Gordon Padwick

Thanks for the answer to my question, but what you say really isn't very
helpful. If I asked you what a car is, would you reply that it's anything
provided by an automobile manufacturer? No, I think you would reply by
describing that a car looks like, what its principal components are, and
what it's purpose is.

What I'm looking for is information about what a dependency property is,
what it consists of, and what its purpose is.

In a similar vein, I have problems with the words "attribute" and
"property." Some of what I read seems to treat these two words as synonyms.
In other places, "attribute" seems to refer to any characteristic of an
object, whereas other texts seem to use the word "property" to refer only to
physical aspects of an object, such as its color and size.

I would find it helpful to see some examples of properties that are
dependency properties and other properties that are not dependency
properties.

Thanks for your help.

In a similar vein, I'd like to understand what the words "attribute" and
"property" mean within the context of C# and WPF.
As a newcomer to C# and WPF I'm having much difficulty understanding
terminology. I come across such terms as "Dependency Property" and need to
know what that term means. The help file in Visual Studio 2008 contains
much
information about Dependency Properties, but doesn't tell me what a
dependency property is. Likewise, the several books about C# and WPF I
have
contain information about dependency properties, but don't tell me what a
dependency property is.

Can someone give me, in two or three sentences, an explanation of what a
dependeny propery is?

Sure. A dependency property is a property implemented using
DependencyProperty class. :)

That's really all there is to it. There no specific theory behind it,
that's why there's no "proper" definition.

From this definition follows that dependency properties are strictly a
WPF feature, and have nothing to do with C# specifically.
 
G

Gordon Padwick

I do have Adam Nathans's book and, yes, it does contain information about
dependency properties. But, it doesn't tell me what a dependency property
is. The book's index contains refereneces to "dependency property" but
doesn't refer to the page on which the subject of dependency properties is
introduced.

Books, such as Nathan's, should provide a basic definition ot terms such as
"dependency property."

I strongly protest your comment "despite being published by Sams." In my
judgement, books published by SAMS are amomg the best written and best
edited books available on computer subjects.

Gordon
 
P

Pavel Minaev

Thanks for the answer to my question, but what you say really isn't very
helpful. If I asked you what a car is, would you reply that it's anything
provided by an automobile manufacturer? No, I think you would reply by
describing that a car looks like, what its principal components are, and
what it's purpose is.

What I'm looking for is information about what a dependency property is,
what it consists of, and what its purpose is.

No, in your original post, you were not. You were asking for a
definition, which is a different thing.

The question of what a dependency property consists of is answered by
the statement that it is implemented via a DependencyProperty pattern
(i.e. it consists of a DependencyProperty object, and normally also
exposed via a plain property in the class itself). Its purpose is to
enable attached properties, property inheritance, and advanced change
notification. All this is described on MSDN in article on dependency
properties, and a search in it will give you more (basically, just
look for "... can only be done if target property is a dependency
property", and you can make the list of what DPs are about).

A concise definition is a very different thing, but I'm not aware of
one for DPs. The best you can get is the one I gave you originally. Of
course it's not very useful, but you don't need to have a definition
to use DPs. You just need to know how to define them, how to use them,
and what they can do.
In a similar vein, I have problems with the words "attribute" and
"property." Some of what I read seems to treat these two words as synonyms.
In other places, "attribute" seems to refer to any characteristic of an
object, whereas other texts seem to use the word "property" to refer onlyto
physical aspects of an object, such as its color and size.

There are two distinct definitions of the word "attribute", one in OOD
theory context (and some languages and frameworks that follow that),
another specifically in .NET.

In OOD, "attribute" is typically some named piece of data that applies
to a specific object instance. Attributes represent state, as opposed
to methods, which represent behavior.

In .NET, the same thing is described as "field" or "property",
depending on implementation. On the other hand, "attribute" in .NET
always refers to a class derived from System.Attribute (which
represents custom arbitrary metadata attached to various .NET entities
such as assemblies, types, and members, or to an instance of such a
class. These definitions are common to CLR object model, and not
specific to C# (and most definitely not to WPF).
I would find it helpful to see some examples of properties that are
dependency properties and other properties that are not dependency
properties.

Go to MSDN, find documentation on namespace System.Windows.Controls,
and pick a class at random. Any property for which it says "This is a
dependency property", is, well, a dependency property. Any property
for which it doesn't say that is not a dependency property. E.g.
ContentControl.Content is a dependency property,
FrameworkElement.Parent is not.
 
C

Chris Nahr

I do have Adam Nathans's book and, yes, it does contain information about
dependency properties. But, it doesn't tell me what a dependency property
is. The book's index contains refereneces to "dependency property" but
doesn't refer to the page on which the subject of dependency properties is
introduced.

??? This is patently wrong. The main index entry for "dependency
property" in Nathan's book refers to page 51 where an entire section
on the subject starts, complete with a thorough explanation and
example implementation.
I strongly protest your comment "despite being published by Sams." In my
judgement, books published by SAMS are amomg the best written and best
edited books available on computer subjects.

Nathan's book is certainly excellent, and I heard good things about
other entries in the recent "Unleashed" series as well, but Sams is
rather notorious for its "Teach Yourself <Arbitrarily Complex
Technology> in 24 Hours" trash.
 
G

Gordon Padwick

Many thanks, Pavel, for taking the time to write the detailed reply. Now,
I'm on my way to a better understanding. Gordon.
Thanks for the answer to my question, but what you say really isn't very
helpful. If I asked you what a car is, would you reply that it's anything
provided by an automobile manufacturer? No, I think you would reply by
describing that a car looks like, what its principal components are, and
what it's purpose is.

What I'm looking for is information about what a dependency property is,
what it consists of, and what its purpose is.

No, in your original post, you were not. You were asking for a
definition, which is a different thing.

The question of what a dependency property consists of is answered by
the statement that it is implemented via a DependencyProperty pattern
(i.e. it consists of a DependencyProperty object, and normally also
exposed via a plain property in the class itself). Its purpose is to
enable attached properties, property inheritance, and advanced change
notification. All this is described on MSDN in article on dependency
properties, and a search in it will give you more (basically, just
look for "... can only be done if target property is a dependency
property", and you can make the list of what DPs are about).

A concise definition is a very different thing, but I'm not aware of
one for DPs. The best you can get is the one I gave you originally. Of
course it's not very useful, but you don't need to have a definition
to use DPs. You just need to know how to define them, how to use them,
and what they can do.
In a similar vein, I have problems with the words "attribute" and
"property." Some of what I read seems to treat these two words as
synonyms.
In other places, "attribute" seems to refer to any characteristic of an
object, whereas other texts seem to use the word "property" to refer only
to
physical aspects of an object, such as its color and size.

There are two distinct definitions of the word "attribute", one in OOD
theory context (and some languages and frameworks that follow that),
another specifically in .NET.

In OOD, "attribute" is typically some named piece of data that applies
to a specific object instance. Attributes represent state, as opposed
to methods, which represent behavior.

In .NET, the same thing is described as "field" or "property",
depending on implementation. On the other hand, "attribute" in .NET
always refers to a class derived from System.Attribute (which
represents custom arbitrary metadata attached to various .NET entities
such as assemblies, types, and members, or to an instance of such a
class. These definitions are common to CLR object model, and not
specific to C# (and most definitely not to WPF).
I would find it helpful to see some examples of properties that are
dependency properties and other properties that are not dependency
properties.

Go to MSDN, find documentation on namespace System.Windows.Controls,
and pick a class at random. Any property for which it says "This is a
dependency property", is, well, a dependency property. Any property
for which it doesn't say that is not a dependency property. E.g.
ContentControl.Content is a dependency property,
FrameworkElement.Parent is not.
 

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