Lambda expressions delegates problems migrate .net 2.0 to .net 3.5 web app

 

On migrate some code from .net 2.0 to 3.5 in an web application i was trying some of the linq to objects queries on an specific data types. So far so good, but compiler said –“ “.

the application has vb.net and c# code also before linq syntax correctly compilable .

resolution was chaging the properties of the class from : 

   1:  public class myDataObject
   2:  {
   3:      private int _FeatureID; 
   4:   
   5:      public int FeatureID
   6:      {
   7:          get { return _FeatureID; }
   8:          set { _FeatureID = value; }
   9:      } 
  10:   
  11:  } 

to:

public class myDataObject 
{ 

    public string FeatureID { get; set; }
}

 

and adding to web.config compiler specific settings

<system.codedom>
   <compilers>
     <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
       <providerOption name="CompilerVersion" value="v3.5" />
       <providerOption name="WarnAsError" value="false" />
     </compiler>
   </compilers>
</system.codedom>

 

Technorati-Tags: ,

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s