Custom use of indexers []
<p>I want to create an object that will work in a similar way to ASP.Net Session.</p>

<p>Say I call this object mySession, I want to make it so when you do </p>

<pre><code>mySession["Username"] = "Gav"
</code></pre>

<p>It will either add it to a database table if it doesnt exist or update it if it does. I can write a method to do this but have no idea how to get it to fire when used with the indexer syntax ([]). I've never built an object that does anything like this with indexers.</p>

<p>Before anyone says anything I know the ASP.Net session can save to database but in this case I need a slightly simpler customized solution.</p>

<p>Any pointers or examples of using indexers in this way would be great.</p>

<p>Thanks</p>
