<p>I use an anonymous object to pass my Html Attributes to some helper methods.
If the consumer didn't add an ID attribute, I want to add it in my helper method.</p>

<p>How can I add an attribute to this anonymous object?</p>

I assume you mean anonymous types here, e.g.
```
new { Name1=value1, Name2=value2}
```
etc. If so, you're out of luck - anonymous types are normal types in that they're fixed, compiled code. They just happen to be autogenerated.
What you
could
do is write
```
new { old.Name1, old.Name2, ID=myId }
```
but I don't know if that's really what you want. Some more details on the situation (including code samples) would be ideal.
Alternatively, you could create a container object which
always
had an ID and whatever other object contained the rest of the properties.