Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#4.0
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>(); 

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 20:25pm
Rate this: bad
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:[^].
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;
Rate this: bad
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

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

  Print Answers RSS
0 OriginalGriff 445
1 Sergey Alexandrovich Kryukov 322
2 Maciej Los 275
3 CHill60 195
4 King Fisher 179
0 OriginalGriff 240
1 Maciej Los 95
2 Sascha Lefévre 85
3 King Fisher 70
4 F-ES Sitecore 55

Advertise | Privacy | Mobile
Web04 | 2.8.150327.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2015
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