I have some experience in developing with Java, Javascript and PHP.

I am reading Microsoft Visual C# 2010 Step by Step which I feel it is a very good book on introducing you to the C# language.

I seem to be having problems in understanding the static keyword. From what I understand this far if a class is declared static all methods and variable have to be static. The main method always is a static method so in the class that the main method exists all variables and methods are declared static if you have to call them in the main method. Also I have noticed that in order to call a static method from another class you do not need to create an object of that you can use the class name.

What are the advantages of declaring static variables and methods?

When should I declare static variable and methods?


Question: Extract data from DateListPlot, limited by PlotRange
Answer: This should do it:

points2 = 
 With[{range = Part[PlotRange /. Options[plot2], 1]}, 
  Select[Flatten[Cases[Normal@plot2, Line[pts_] :&gt; pts, Infinity], 1],
     First@range &lt;= First@# &amp;&amp; First@# &lt;= Last@range &amp;][[All, 2]]]


With plot2 as in your example:


  {3., 4., 5.}