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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:43:19+00:00 2026-06-13T01:43:19+00:00

I am new to asp.net & trying create a object, but there is a

  • 0

I am new to asp.net & trying create a object, but there is a syntax error

public class pair
{

    private string key;
    private string value;

    public pair(string key, string value)
    {
        this.key = this.setKey(key);
        this.value = this.setValue(value);
    }

    private void setKey (string key) {
        this.key = key;
    }

    public string getKey()
    {
        return this.key;
    }

    private void setValue(string value)
    {
        this.value = value;
    }

    public string getValue()
    {
        return this.value;
    }

}

these two lines

this.key = this.setKey(key);
this.value = this.setValue(value);

have something wrong, anyone know the problems?

  • 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-13T01:43:20+00:00Added an answer on June 13, 2026 at 1:43 am

    You just need two properties here or just use

    public class Pair
    {
        public string Key { get; private set; }
        public string Value { get; private set; }
    
        public Pair(string key, string value)
        {
            this.Key= key;
            this.Value = value;
        }   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to ASP.net & Jquery.I am trying to implement autocomplete in my
I'm trying to create an auction site using asp.net. My auction's start date &
I am new to programming. Using C# & ASP.Net, how would I differentiate between
I have a new asp.net mvc project and i am trying to figure out
I'm trying to get Twitter authentication working on my ASP.NET site. When you create
I'm trying to write REST-behaviour into my ASP.NET MVC2 app, but I'm having a
i'm new in asp.net mvc 2. I'm trying to list all data from one
I'm rather new to the ASP.net MVC world and I'm trying to figure out
I'm new to ASP.NET but have quite a few successful test pages going now
I'm receiving the following error when trying to run an ASP.NET MVC 3 project:

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.