linq - The type or namespace name 'var' could not be found in asp.net 2.0 -


i using asp.net 2.0.i trying built application on how build store locator asp.net application using google maps api.when trying use "var" in pplication giving error "the type or namespace name 'var' not found (are missing using directive or assembly reference?)".

i have downloaded above article , working correctly in vs2005.i wonder why error comes in project ??

namespace have used in application

using system; using system.collections.generic; using system.web; using system.xml.linq; using system.linq; 

heres class have used

public static xelement getgeocodingsearchresults(string address) {     // use google geocoding service information user-entered address     // see http://code.google.com/apis/maps/documentation/geocoding/index.html more info...     var url = string.format("http://maps.google.com/maps/api/geocode/xml?address={0}&sensor=false", httpcontext.current.server.urlencode(address));      // load xml xelement object (whee, linq xml!)     var results = xelement.load(url);      // check status     var status = results.element("status").value;     if (status != "ok" && status != "zero_results")         // whoops, else wrong request...         throw new applicationexception("there error google's geocoding service: " + status);      return results; } 

the errors getting follows

error 1 : type or namespace name 'var' not found (are missing using directive or assembly reference?)  error 2 : best overloaded method match 'system.xml.linq.xelement.load(string)' has invalid arguments  error 3:cannot convert 'var' 'string' 

var keyword not available in .net 2.0 (c# 2.0).

it available in c# 3.0 onwards. c# language feature , not available in older versions.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -