Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
Hi,
What's the problem in that code this code is working in Development but when i try to put that page in Live it shows the error
AData.A0.get' must declare a body because it is not marked abstract or extern
 
 
public class AData
    {
        public int A0 { get; set; }
        public int A1 { get; set; }
        public int A2 { get; set; }
        public int A3 { get; set; }
        public int A4 { get; set; }
    }
    List<AData> grid2Data = new List<AData>(); 
 

Page_load
 
if (!IsPostBack)
        {
          
            grid2Data.Add(new AData() { A0 = 0, A1 = 0, A2 = 0, A3 = 0, A4 = 0 });
        }   
 
can anyone help me to solve this issue...
 

thanx in Advance...
Posted 9-Oct-12 19:25pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I never so such thing, but I have a strong impression that this is because "in Live" an outdated C# compiler is used, the one prior to v.3.0, when auto-implemented properties were introduced:
http://msdn.microsoft.com/en-us/library/bb384054.aspx[^].
 
If this is C#2.0, it's still maybe not too bad (generics and anonymous types were there, and this is already good, and one can live without lambdas and syntax improvements, and WPF is not used in ASP.NET). However, if this is something prior to v.2.0, it means some version of .NET which I personally don't even consider as "real". Yes, at that time we already had fully functional .NET, but too me, it's quality was more of a pre-release. No, first decent .NET was v.2.0.
 
Please check it up. If this is really the case, there are two solution: 1) use hosting where the newer software is used, 2) work-around to comply with C# 2.0 syntax.
 
In your case, the work-around may look like this:
public class AData {
   public int A0 { get { return a0; } set { a0 = value; } }
   inf a0;
   //...
}
 
—SA
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Automatic properties did not arrive in visual studio until VS 2008 (c# 3.0).  You need to do it the old way in VS 2005:
 

private int _x, _y;
public int X {get {return _x;} set {_x = value;}}
public int Y{get {return _y;} set {_y = value;}}
 
Else check your app pool or webconfig which should support this dotnet framework
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 459
1 Nirav Prabtani 338
2 Abhinav S 170
3 PIEBALDconsult 160
4 Pikoh 140
0 OriginalGriff 7,640
1 Sergey Alexandrovich Kryukov 6,836
2 Maciej Los 3,919
3 Peter Leow 3,698
4 CHill60 2,742


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100