Question: Because I am creating DOM using Jquery it was difficult to copy the output so i am adding one image of code that i have captured using one tool

![enter image description here](https://i.stack.imgur.com/TKZnp.png)

i have attached hover and mouseout event to `id='nf1'` using this code

```
$("#nf"+n).hover(function(){
    $("#nf"+$(this).attr("post_id")+"post_delete").show();
});
$("#nf"+n).mouseout(function(){
    $("#nf"+$(this).attr("post_id")+"post_delete").hide();
});

```

Here n is post\_id and i am looping all post\_id got from response.This attach events but not giving expected behaviour Like when mouse over to `id='nf1post_delete'` it is hide 

Please ask if any doubts

Answer: 
In most cases, I would probably go with Anders' answer. Depending on your situation, another way that is worth considering is to write [extension methods](http://msdn.microsoft.com/en-us/library/bb383977.aspx) for List.

```
namespace ExtensionMethods
{
    public static class MyExtensions
    {
        public static object DoSomething(this List<T> list)
        {
            //do the something with list
        }
    }   
}

```

And then you can use it like so:

```
var list = new List<int>();
list.DoSomething();

```

In that example, `list` is passed as the parameter to the extension method.
Usually a `List<T>` shouldn't belong to the state of an instance and exposed since it's mutable and you may change the state from the outside otherwise -unless your getter is designed to return a readonly list. Unless your design clearly allow such a possibility when it may occur. My reply doesn't really answer to your question is just a suggestion of good object oriented design. As someone already suggested much better than me you may pass a List back and forth each method and directly modify it.