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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:07:06+00:00 2026-06-05T04:07:06+00:00

I need to design a class where one property name has to be return

  • 0

I need to design a class where one property name has to be return, but when I create a property name like return then I get an error.

After some research I found out that one can use a reserved keyword as a property or variable name by adding a @ prefix in C#, or by enclosing it in square brackets [] in VB.NET. For example:

var @class = new object();

So here is my class design code.

public class Person
{
    string _retVal;

    public string @return
    {
        get { return _retVal; }
        set { _retVal = value; }
    }
}

...
Person p = new Person();
p.@return = "hello";

Now I am not getting any error, but when I try to access property name like return then I need to write the name like @return, which I don’t want. I want to access the property name like p.return = "hello"; instead of p.@return = "hello"; so I’d like to know if there is any way to do that?

  • 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-05T04:07:07+00:00Added an answer on June 5, 2026 at 4:07 am

    You can’t. It is a reserved keyword. That means “you can’t”. Contrast to “contextual keywords” which usually means “we added this later, so we needed it to work in some pre-existing scenarios”.

    The moderate answer here is: use @return.

    A better answer here is: rename your property. Perhaps ReturnValue.

    There is also the option of, say, Return – but you might need to think about case-insensitive languages too.

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

Sidebar

Related Questions

All I need is a way to make a property of one class only
I have a class which is going to need to use the strategy design
Why do we need design patterns like Factory, Abstract Factory and Singleton?
Need to design a simple one for school. More specifically a Moore FSM. Im
I'm working on an assignment has a class hierarchy like blow: abstract EventClass someEventClass1
This is another one of my I think it's not possible but I need
I have a class (say Product) with a property (say product_id) and has methods
I need some design suggestions for an Image class hierarchy. Currently, I have 2
I need some design help for my concepts:- My concept is mother page contain
I need to design a Turing Machine Simulator in C++ that takes in an

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.