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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:03:07+00:00 2026-05-17T19:03:07+00:00

I have created an inherited class StorageMedium from a base I called DataTypes. StorageMedium

  • 0

I have created an inherited class “StorageMedium” from a base I called “DataTypes”.
StorageMedium has two properties, Name() and Capacity().

In the DataTypes object, which all other objects in the class library have been inherited from, I have suppressed the Equals, ReferenceEquals, GetHashCode, ToString and GetType functions so these functions are not browsable in the Visual Studio editor.

The purpose is due to the fact the class library will be eventually used by users are not “programmers”, and I want to hide any unecessary code or functions they might come across.

I have a second Class that “creates” the instances of the StorageMedium:

    Shared ReadOnly Property DVD() As StorageMedium
        Get
            Return New StorageMedium(NewMedium.DVD)
        End Get
    End Property

    Shared ReadOnly Property CD() As StorageMedium
        Get
            Return New StorageMedium(NewMedium.CD)
        End Get
    End Property

On my webpage, I want to call the creation class and create instance of the StorageMedium and display the name and capacity as a string with the name and capacity

  Response.Write(StorageMedium.Utils.DVD)
  DVD: 4.7Gb

However, when I use the Response.Write method it displays the full class name

  Response.Write(StorageMedium.Utils.DVD)
  LC.Utils.Convert.Computer.DataType.StorageMedium

It’s fair to assume this is probably caused by the suppression of the basic Object functions, however, is there a way to “rehook-up” or recreate a default function to utilitise the ToString functionality without creating a property like “ToOutput” to
display the object as required?

Thanks.

  • 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-17T19:03:08+00:00Added an answer on May 17, 2026 at 7:03 pm

    You could try this:

    public class StorageMedium {
        // Other code
        public static implicit operator String(StorageMedium instance) {
            return "StorageMedium"; // Or whatever string you prefer
        }
    }
    

    Although overriding ToString() is obviously preferred.

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

Sidebar

Related Questions

I have created a sample app where i have created some class inherited from
How can I change XML-element name for field inherited from base class while doing
Example: I have an class that inherits from UIImageView. An object creates an instance
I am making a win32 api program. I first created a base class called
Hey guys, I've created a CustomFileUpload class which is inherited from the original FileUpload
I have created an inherited document class, see the code below. The documents persists
I have created a common class with it's admin class which should be inherited
I have created two tables & inserted values as shown below . Table 1
I have created 3 classes as following Ext.mine.TextParent - Inherting from Textfield Ext.mine.child.TextChildA -
I have a working model, but have noticed that the relationship has been created

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.