These two words are completely synonymous for me, but I wonder if there's actually a useful semantic difference that I can incorporate into coding/naming conventions/process.

  • 7
    In .NET they are completely different things. Property and Attribute
    – ChrisF
    Oct 4, 2011 at 21:32
  • Your saying as a .net developer I'd be wise to only call something an attribute if it refers to an actual .NET attribute class.. yeah that makes sense. Thanks, Oct 4, 2011 at 21:34
  • 2
    Entirely depends on context, as @ChrisF commented.
    – Oded
    Oct 4, 2011 at 21:34
  • @DavidSchwartz There is no concept of a inter-site duplicate, and the answers on Stack Overflow aren't particularly useful.
    – user8
    Oct 4, 2011 at 22:53

3 Answers 3


The English words have overlapping meanings but slightly different implications. Property implies something possessed by something else. Attribute suggests something that is an inherent characteristic.

However, because their meanings almost completely overlap, you can substitute one for the other. The exception would be where the terms are jargon, for example in C# where property and attribute have different, much more specific, meanings. In HTML, there is something specifically called a tag attribute and calling it a property would be confusing.

If you're inventing new jargon for a specific context, I would say to prefer whichever sounds more natural. If it's something discrete that something else contains, I'd generally prefer property. If it's something that is an inseparable inherent characteristic of something else (and especially if it's something other things can have as well), I'd generally prefer attribute.

  • I wonder if attribute vs property carries any implication for inheritance ... brainsplosion.
    – James
    Jan 26, 2017 at 7:18

The definition of Properties and Attributes are context sensitive based on the programming language/markup you're using.

In standard markup languages (XML, HTML, SVG, etc) an attribute is well defined

<xml version="1.0"> <!-- The attribute here is version -->

In other programming languages an Attribute is an object where a property is a stored value

public Attribute FirstName { get; set; } // C# Property which stores and returns an Attribute object :-D

Attributes represents the state of the object.

Properties are used synonymously as attributes but its depends on language. Properties are getters and/or setters which are invoked as we read it or assign it.

With properties , we can add error handling code to prevent the object to be in unsafe state.But we cant do the same with attributes as they are just meant to store some value.


her.age = -10;

// shes is in unsafe state as age cannot be negative

but if her.age is a property , it may check before assign new age to the attribute i.e. private one.

if(newAge >= 18) 

{ *// then do someThing..* }


  *// throw some exception*

// here newAge is arg to property age

Properties just execute some error handling code.

You can add custom code to it too.

  • 1
    is this only your opinion or you can back it up somehow?
    – gnat
    Dec 11, 2015 at 13:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.