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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:03:29+00:00 2026-05-20T18:03:29+00:00

I would like to create a interface that I can use with different types.

  • 0

I would like to create a interface that I can use with different types. Like a table where columns may be of different types eg Integer, String, Date.

The following articles have been of great help.

ListBox, list of different objects implementing the same interface

List of two different Types in C#

The problem I have is that the i still need a common interface that can handle different types of data. How can I get around this?

Could I just have the main Interface store as a string and have all types converted to and from?

interface IMytype
{
    string Item { get; set; }
}

class Myint : IMember
{
    public int Item { 
                 get; // code here  IMytype.Item (get) then convert to int
                 set; //  code here to convert to string then IMytype.Item (set) 
                }
}

Example

IMytype testint = new MyInt();

testint.Item = 10;

List<IMytype> testlist = new List<IMytype>();

testlist.add(testint);

Am I on the right track?

  • 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-20T18:03:30+00:00Added an answer on May 20, 2026 at 6:03 pm

    An interface is a contract that states what behaviour that class will provide. It does should not specify what data the class will hold.

    You wish to build up a list of objects that conform to a particular contract – you want them all to behave in a particular way. You are getting confused by the fact that these classes will all have a different internal representation – some represent ints, others may represent floats etc..

    You need to step back, and decide what shared behaviour you want these classes to implement. This will form the basis of your interface.

    So you want to be able to get a String representation of the data. This is one method for your interface.

    You want the class to be able to receive a string and convert that to its internal type? Theres another method.

    Do these types need to Wangle a Flux Capacitor?

    There’s your interface.

    interface IMytype
    {
        string GetStringValue ();
        void ReadString ( string value);
        bool WangleFluxCapacitor();
    }
    

    Think about the shared behaviour first.

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

Sidebar

Related Questions

I would like to create a user interface like the iGoogle or facebook profiles
In Interface Builder components I have Gradient Button I would like to create this
I would like to create a c++ type that mimic the build-in type exactly.
I would like to create a class that runs something (a runnable) at regular
I would like to create a set of custom controls that are basically image
I have this C# class structure that I would like to refactor to use
i would like create a array of structure which have a dynamic array :
I would like to create this shape using just css. I am pretty sure
I would like to create a json object to send as a post array,
I would like to create set of strings and below is the only limitation.

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.