Question: This question is related but not the same as this: [How do you give a C# Auto-Property a default value?](https://stackoverflow.com/questions/40730/how-do-you-give-a-c-auto-property-a-default-value)

I love auto-properties, but sometimes I have to do something like this:

```
private string someName;

public string SomeName
{
    get
    {
       return someName;
    }

    set
    {
        someName = value.Trim();
    }
}

```

If I have to do the same thing many times, I start wishing that I did not need to type so many lines/characters of code. I want to be able to intercept the value and change it sort of like so:

```
public string Somename
{
    get;

    [Trim]
    set;
}

```

Is there a way to do something like this? Would it be stupid? Is there a better way? Any other general comments? I admit, the example I gave is a bit hypothetical and I cannot locate the exact code now which made me think of this.

Thanks.

Answer: 
Your database is not normalized. You say it's all in one table, but you haven't given any information about the schema.

The kinds of problems which non-normalized databases have include problems with consistency related to storing redundant information - if you have something like:

Album, Track, Artist

then to change the Album name, you have to change it on every track associated with the Album.

Of course, there are all kinds of "database" systems out there which are not normalized, but these usually have mechanisms to handle these kinds of things which are appropriate to their paradigms.
So the subject you're asking about is called "Normalization" and while this is useful in many circumstances, it can't always be applied.

Consider the artist Pink. Some of her albums have her name as `Pink` and others `P!nk` which we recognize as the same visually, because we know it's her. But a database would by force see these two separately (which also makes searching for her songs harder, but that's another story). Also consider Prince, "The artist formally known as Prince", etc.

So it might be possible to have an artist `ID` that matches to both `Pink` and `P!nk` but that also matches to her albums `Funhouse` etc. (I'm really gonna stop with the examples now, as any more examples will need to be tabular).

So, I think the question becomes, how complex do you want your searching to be? As is, you're able to maintain a 1:1 correlation between tag and database info. It just depends how fancy you want things to be. Also, for the lookup I mentioned above, consider that most times that information is coming from the user, you really can't supply a lookup from P!nk to Pink any more than you would from Elephant to Pachyderm because you don't know what people are going to want to enter.

I think in this case, the naive approach is just as well.