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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:33:48+00:00 2026-06-12T20:33:48+00:00

I have a class as follows: public class RecipientEmailDetails { public string Name {

  • 0

I have a class as follows:

public class RecipientEmailDetails
{
    public string Name { get; set; }
    public string Email { get; set; }
    public List<VacancyEmailDetails> Vacancies { get; set; }
}

This class needs to be changed to allow Vacancies to take in generic data for example as below:

public class RecipientEmailDetails<T>
{
    public string Name { get; set; }
    public string Email { get; set; }
    public List<T> Vacancies { get; set; }
}

Unfortunately at present if I do this I’ll need to change all the code that instantiates this class (which is many, many locations) to include this new generic type for example changing this:

List<RecipientEmailDetails> recipientEmailDetails = wrapper.GetRecipientEmails(emailCount);

To this:

List<RecipientEmailDetails<VacancyEmailDetails> recipientEmailDetails =   wrapper.GetRecipientEmails(emailCount);

Ultimately this is a lot of changes and many of these current locations will have no knowledge (and ideally should have no knowledge) of what type of data is stored in Vacancies. They will simply forward this information on until eventually the Vacancies list is checked and processed.

Anyway cut to the chase I’m looking for clever ways to store generic data in Vacancies without having to change everywhere how the RecipientEmailDetails object is initialised. I’d rather not have to box it and unbox it.

I should add that VacancyEmailDetails is currently like this:

public class VacancyEmailDetails
{
    public string Id { get; set; }
    public string Name { get; set; }
    public string Location { get; set; }
    public string Salary { get; set; }
    public string Notes { get; set; }
}

In all cases Vacancies will be rquired to hold objects similar to this one i.e. mainly data members with little or few methods. However the number, names and types of these members will vary considerably.

  • 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-06-12T20:33:50+00:00Added an answer on June 12, 2026 at 8:33 pm

    Thanks for the reponses. I decided against the Interface and instead redefined the class to this:

    public class RecipientEmailDetails
    {        
        public string Name { get; set; }
        public string Email { get; set; }
        public List<Dictionary <string, string>> Vacancies { get; set; }
    }
    

    The only thing then that had to change where a few lines such as these:

    new RecipientEmailDetails{
        Name = "Test1",
        Email = "Test@hotmail.com",
        Vacancies = vacancies.Select(z => new VacancyEmailDetails{
                                               Id = z.Id.ToString(),
                                               Notes = z.Notes
                                           }).ToList()};
    

    To these:

    new RecipientEmailDetails{
        Name = "Test1",
        Email = "Test@hotmail.com",                                       
        Vacancies = vacancies.Select(z => new []{
    new {Key = "Id", Value = z.Id.ToString()},
    new {Key = "Notes", Value = z.Notes}}.ToDictionary(d => d.Key, d => d.Value)).ToList()})
    

    This allowed me to do what I required and only to have to be explicitly concerned with the contents of Vacancies when I was populating and extracting the data from it and not everywhere RecipientEmailDetails was referenced.

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

Sidebar

Related Questions

I have a class that has a method as follows :- public void setCurrencyCode(List<String>
I have my class structure as follows public class Email { public string Subject
I have two classes as follows: public class Info { [XmlAttribute] public string language;
I have a class as follows: Public Class Courses Public CoursesOfferedMAIN As New List(Of
I have a C# class defined as follows: public class GenericItem<T> { public List<T>
I have ViewModel class as follows: public class ListViewModel { public ObservableCollection<InfoItem> List {
I have a class as follows class DataGridItem { public bool IsSpecial; public string
I have a class that follows the form: public class Cat { public string
I have a class as follows Public Class Foo Private _Name As String <ShowInDisplay()>
I have a class as follows: class TestSomeData { public string someString; public void

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.