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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:05:50+00:00 2026-05-11T12:05:50+00:00

I am self-studying a C# reference and it gives the following information: 1.21.4. Declaring

  • 0

I am self-studying a C# reference and it gives the following information:

1.21.4. Declaring Generic Parameters Generic parameters can be introduced in the declaration of classes, structs, interfaces, delegates (see the upcoming ‘Delegates’ section), and methods. Other constructs, such as properties, cannot introduce a generic parameter, but can use a generic parameter. For example, the property Value uses T:

public struct Nullable<T> {   public T Value {get;} } 

First, I get an error trying to compile this saying that it must contain a body because it is neither abstract nor extern or that automatic parameters must have both get and set accessors.

Second, assuming it is wrong and I correct it by adding ‘set;’, I cannot seem to format a call to it successfully.

  • 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-11T12:05:51+00:00Added an answer on May 11, 2026 at 12:05 pm

    I’m not sure if you just picked a bad example for your struct name (since Nullable is a framework struct), but if not, the error is due to the fact that you have no set accessor in your property. Automatic properties (added in C# 3.0) need both a get and set property. So, if you change the code to:

    public struct Nullable<T> {   public T Value {get; set; } } 

    it should work. In this case, the error had nothing to do with generics. To create an instance, you could use:

    Nullable<int> i = new Nullable<int>(); 

    This will make it compile. However, as both Jon and Cerebrus has pointed out, it’s probably just an example to show the workings of generics.

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

Sidebar

Related Questions

I am self studying computer architecture offer at Michigan university. I do not understand
I am doing self-studying of operating systems. Tanenbaum in his book modern operating systems
I'm stuck with this. I'm self studying assenbler and translating some basics instructions. But
I'm currently self-studying C# in my free time and thought of a little project
I'm currently self-studying C for mastering an university project. In that project we have
I'm studying Ruby and my brain just froze. In the following code, how would
From my studying of python, I've found two uses for %. It can be
I'm studying object literals and self-executing functions in Javascript. Looking through some YUI code
When studying carefully gproc project's gproc_tests.erl file. I have found the following code. The
I am self studying Android and now I am learning how to use buttons.

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.