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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:57:22+00:00 2026-05-15T23:57:22+00:00

Is it possible to extend primitive types such as System.String and System.Int32 (IE: integer)

  • 0

Is it possible to extend primitive types such as System.String and System.Int32 (IE: integer) in .Net 4 and if so how?

To be more specific, I am aware of the concept of partial classes but this doesnt seem to be the answer. Also I find that System.String is not inheritable and Int32 is a structure.

Lastly I am interested in knowing both a VB.Net and C# answer to the above question.

Thanks all..

  • 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-05-15T23:57:23+00:00Added an answer on May 15, 2026 at 11:57 pm

    You cannot extend them directly – the String class is sealed, for example, and as you noted value type wrappers (such as Int32) are normally structs.

    You can write extension methods (C#, VB.NET) to them, that’s what they are there for.

    Another option, is to write a wrapper around these, exposing all of their properties and adding more functionality.

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

Sidebar

Related Questions

Is it possible to extend more then one abstract class? I'm trying to convert
Is it possible to decorate/extend the python standard logging system, so that when a
Possible Duplicate: Why don't Generics support primitive types? I want to make one function
Possible Duplicate: Java: Array of primitive data types does not autobox I've been doing
Possible Duplicate: Extend a line segment a specific distance Ok for some reason I'm
Is is possible to extend, for instance, the HyperLink control using a partial class?
It is possible to extend a class like string (see http://www.c-sharpcorner.com/uploadfile/mgold/extendingstringclass03162008132109pm/extendingstringclass.aspx ) is there
With generic methods it's possible to extend more than one type, e.g.: <T extends
Would be possible to extend this kind of layout so that I can have
Is it possible to extend a base template with another template in Smarty? I

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.