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

  • SEARCH
  • Home
  • 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 100653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:37:14+00:00 2026-05-11T00:37:14+00:00

The following code for a co-worker throws the following error when he tries to

  • 0

The following code for a co-worker throws the following error when he tries to compile it using VS 2008:

Error:

A new expression requires () or [] after type

Code:

MyClass Structure:

public class MyClass {     public MyClass() {}      public string Property1 { get; set; }     public string Property2 { get; set; } } 

Sample Source Code:

List<MyClass> x = new List<MyClass>();  x.Add(new MyClass  {     Property1 = 'MyValue',     Property2 = 'Another Value' }); 

It ‘works on my machine’, but not his. Any idea why?

UPDATE
He is targeting the 3.5 .NET framework
He is using the System.Collections.Generics namespace
The MyClass object does have a constructor

UPDATE 1:
@Funky81 – Your example and my example were able to compile on my PC.

Update 2:
Included schema of MyClass in sample

UPDATE 3:
@DK – I had my co-worker add the following configuration section to his application:

<system.codedom>         <compilers>             <compiler language='c#;cs;csharp' extension='.cs' warningLevel='4' type='Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'>                 <providerOption name='CompilerVersion' value='v3.5'/>                 <providerOption name='WarnAsError' value='false'/>             </compiler>             <compiler language='vb;vbs;visualbasic;vbscript' extension='.vb' warningLevel='4' type='Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'>                 <providerOption name='CompilerVersion' value='v3.5'/>                 <providerOption name='OptionInfer' value='true'/>                 <providerOption name='WarnAsError' value='false'/>             </compiler>         </compilers>     </system.codedom> 

And he received the following compilation error: Unrecognized element ‘providerOption’.

  • 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. 2026-05-11T00:37:15+00:00Added an answer on May 11, 2026 at 12:37 am

    Here’s what seems to be the only similar, but not exactly the same, error available in VS.2008:

    Compiler Error CS1526 : A new expression requires (), [], or {} after type

    Note those {} in error message, which are part of c# 3.0 syntax. This is not related to framework version, but to the version of the language.

    My bet is that somehow a different version of compiler was used.

    Added: this looks like a likely issue with ASP.Net. Place to check is in .config file(s), element

    configuration\system.codedom\compilers\compiler @language='c#...' 

    there should be

    <providerOption name='CompilerVersion' value='v3.5'/> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 90k
  • Answers 90k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You'll need to define a helper method which splits a… May 11, 2026 at 6:04 pm
  • Editorial Team
    Editorial Team added an answer From MSDN: If the operation completes successfully and its result… May 11, 2026 at 6:04 pm
  • Editorial Team
    Editorial Team added an answer If you're running an ASP.NET in a Virtual Directory in… May 11, 2026 at 6:04 pm

Related Questions

I am working on a plugin system that loads .dll's contained in a specified
The code golf series seem to be fairly popular. I ran across some code
My co-workers complain that my Perl looks too much like C, which is natural
Edit: There appears to be at least two valid reasons why Smalltalkers do this

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.