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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:42:03+00:00 2026-06-18T10:42:03+00:00

I have a class in one application – that I cannot change (legacy) –

  • 0

I have a class in one application – that I cannot change (legacy) – that is inside of a assembly (DLL file):

public class ShippingMethod
{
    public string ShipMethodCode { get; set; }
    public string ShipMethodName { get; set; }
    public decimal ShippingCost { get; set; }

    public List<ShippingMethod> GetAllShippingMethods()
    {
    ......
    }
}

I have a second application that is referencing that assembly (DLL file) and needs to populate a drop-down with all the Shipping Methods. Ex: “UPS – $3.25”

The issue is that it needs to be using the correct format for different currencies. Ex: $3.25 or 3.25€ depending on a parameter called CountryID.

I have written a function String DisplayMoney(Decimal Amount, Integer CountryID) that will return the correct format of the amount.

Now I need to apply this function to every shipping method and save it into a new list.
What is the best way to do this?

I can create another class called LocalizedShippingMethods as follows:

public class LocalizedShippingMethod
{
    public ShippingMethod ShipMethod { get; set; }
    public string LocalizedShippingCost { get; set; }
}

Is this the best way to accomplish this? Is there a better way to do this using inheritance? And if I use inheritance, how do I get the values from the first LIST into the NEW LIST?

  • 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-18T10:42:05+00:00Added an answer on June 18, 2026 at 10:42 am

    That is indeed a good method of doing it. You can use a pretty quick Linq query to pull the old List into the new one:

    List<LocalizedShippingMethod> Translate(List<ShippingMethod> oldList)
    {
      return oldList.Select(a => new LocalizedShippingMethod
         {
             // Initialize properties according to however you translate them
         }).ToList();
    }
    

    Additionally, to make this more streamlined and obvious, you could do any of the following to aid in the translation:

    • Create a constructor for LocalizedShippingMethod that takes in a ShippingMethod and properly sets the properties
    • Create a static method on LocalizedShippingMethod that takes in a ShippingMethod and returns an initialized LocalizedShippingMethod
    • Create an operator on LocalizedShippingMethod that converts from a ShippingMethod
    • Create an extension method on ShippingMethod, call it ToLocalized() that returns a LocalizedShippingMethod
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one grails application.In that I have one model class named Book. From
I have one demo application to check select for update query public class Test
i am making applications in c#.In that application i have one class as DataCapture.cs
I have two Activities along with one Application class, and whenever I call my
Do you have one solution with the web application project, class libraries, database project
I have one class. Class First { private Second second; public First(int num, String
I have class which have one public method Start , one private method and
i make one class file for jar. and this class have use wurfl. and
I have one Application class to keep the global state of my application. But
I have the following class as part of an asp.net application. public sealed class

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.