Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7046485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:39:22+00:00 2026-05-28T02:39:22+00:00

I’m creating an asmx webservice in an existing .Net 3.5 website. I would like

  • 0

I’m creating an asmx webservice in an existing .Net 3.5 website. I would like to return a post based on a key. I would like to return the post as an anonymous type, but it is giving me the following error:

Feature ‘anonymous types’ cannot be used because it is not part of the
ISO-2 C# language specification.

Here is a screen-dump of the problem:
Feature 'anonymous types' cannot be used because it is not part of the ISO-2 C# language specification

Any ideas how to solve this?

Note: my asmx is standing on its own. It contains the code, it has no .cs behind it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:39:22+00:00Added an answer on May 28, 2026 at 2:39 am

    The first problem is that you are returning an object.

    As WebService produce definitions (WSDL), how do you expect the definition to be generated without knowing the actual type ?

    You should introduce a DTO styled – class (no logic, only data) like :

    [Serializable]
    public class Post
    {
        public int PostID {get;set;}
        public int ThreadID { get; set; }
        public string Subject { get; set; }
        public string Body { get; set;}
    }
    

    And change your definition to return such class.

    The amount of code is quite light.

    [Edit] The above solution will solve your problem. However, the exact source of the problem is this one :

    When you works in a .cs file, the compiler used is the compiler of the target framework of your project (3.5 here). The compilation occurs at coding time.

    When you works in a .asmx file, the compilation will occurs when the asp.net application will be loaded. The compiler used in the compiler of the asp.net runtime, which is, for the .Net 3.5, the compiler for 2.0 runtime. It’s because the Framework 3.5 is only a new set of classes, but the CLR is still in V2 (changed with the V4). In this case, even if your project is in 3.5, only the code in .cs files can use 3.5 language features. All code in aspx and asmx files can only use V2 language feature.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to count the length of a string with PHP. The string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.