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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:13:39+00:00 2026-05-26T22:13:39+00:00

There is a custom data type for business object properties in one of my

  • 0

There is a custom data type for business object properties in one of my projects. This custom type is a wrapper for the basic Data Types in .NET.

When I try and get the value from the property, the below is displayed if the syntax is:

company.Name 
Interfaces.Model.CustomType`1[System.String]

It is expecting:

company.Name.Value

I would like to avoid the need to use the .value; am I looking to overload an operation, or implicit/explicit methods?

Any help would be great.

Here is the general outline of the CustomType:

public class CustomType<t> 
{
    #region Implicit Casting

        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static implicit operator t(CustomType<t> obj)
        {
            if (obj == null)
                return new CustomType<t>().Value;
            return obj.Value;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static implicit operator CustomType<t>(t obj)
        {
            return new CustomType<t>(obj);
        }
        #endregion Implicit Casting


        /// <summary>
        /// Gets or sets the value.
        /// </summary>
        /// <value>The value.</value>      
        public t Value
        {
            get
            {
                return _value;
            }

            set
            {
                _value = value;
            }
        }


         /// <summary>
        /// Sets the value.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns></returns>

        public CustomType<t> setValue(t value)
        {
            try
            {
                Value = value;
            }
            catch (InvalidCastException e)
            {               

                throw new InvalidCastException("CustomType invalid property cast ", e.InnerException);
            }

            return this;
        }
}
  • 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-26T22:13:40+00:00Added an answer on May 26, 2026 at 10:13 pm

    If I understand correctly you need to override ToString.

    public class CustomType<T>
    {
        public override string ToString()
        {
            return Value.ToString(); //I assume Value is of type T.
        }
    }
    

    I’ve done a certain amount of guessing here, perhaps you could show the code for your custom type and the all that’s giving you the type.

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

Sidebar

Related Questions

There's a way to make it so intellisense will behave appropriately for custom data-types
One of columns(id) in Salesforce custom object is String type though it always contains
Is there a way to create a custom XML data type for Android? I
I store objects of a custom data type in QStandardListItems. I recover these objects
is there any custom asp.net membership providers that someone has already created online. I
In my custom cell there is a UILabel and one UIButton . Whenever I
I have the following situation: There is one custom view inside of the first
I want to associate custom data to a Type, and retrieve that data in
What I'm trying to do is create a new custom data type that behaves
I have a custom data type called StudentID , which has an implicit conversion

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.