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 9006991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:33:45+00:00 2026-06-16T01:33:45+00:00

I get a compilation errors regarding this piece of code: Error 1 Invalid token

  • 0

I get a compilation errors regarding this piece of code:

Error 1 Invalid token ‘(‘ in class, struct, or interface member declaration
Error 2 Cannot use more than one type in a for, using, fixed, or declaration

Any idea why? In addition, is it possible to declare dictionary as follows?

public class S
{
        private class ObInfo<T>
        {
            private string _type;
            private T _value;

            public ObInfo<T>(string i_Type, T Value)
            {
                this._type = i_Type;
                this._value = Value;
            }

            public ObInfo() 
               {}
       }

       private static Dictionary<int,ObInfo> sObj= new Dictionary<int,ObInfo>();
}
  • 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-06-16T01:33:47+00:00Added an answer on June 16, 2026 at 1:33 am
    public ObInfo<T>(...) {
    

    Constructors cannot take generic parameters.
    Remove the <T> and everything will work.

    All methods (and types) inside a class inherit that class’s generic parameters; you should only create generic methods inside generic classes if the methods need a separate type parameter. (this should be avoided; it’s very confusing)


    Also, open generic types are not actually types; you cannot have a Dictionary<int,ObInfo> without specifying the type parameter for ObjInfo.
    Instead, you can either use a non-generic interface for the dictionary, or move the type parameter to the outer class and have a separate dictionary per type parameter.

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

Sidebar

Related Questions

Magento 1.4.2 Having compilation errors and the page doesn't render. I get errors but
I'm iterating through my Model in javascript and I get a compilation error :
Here's the error I get: Description: An error occurred during the compilation of a
With ANTLR, I get some java class files after compilation. And I need to
I get following compilation errors: The method sort(List<T>, Comparator<? super T>) in the type
I know from this thread - template class member function only specialization that if
Why do I get the following compilation error with a simple call to printf?
When I attempt to use OpenFeint with cocos2d, I get compilation errors like those
Updated-2 I have interesting combination of warnings & errors. Firstly, when debugging, i get
I want to set compilation debug=false to get release mode dll's compiled on the

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.