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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:04:49+00:00 2026-05-24T05:04:49+00:00

first: public static String ConvertServerToClientAdapter(String adapterServer) { string temp = adapterServer.Substring(0, adapterServer.IndexOf(/)); switch (temp)

  • 0

first:

public static String ConvertServerToClientAdapter(String adapterServer)
    {
        string temp = adapterServer.Substring(0, adapterServer.IndexOf("/"));
        switch (temp)
        {
            case "f":
                {
                    return "FA";
                }
            case "g":
                {
                    return "Gi";
                }
            case "s":
                {
                    return "SE";
                }
            case "a":
                {
                    return "ATM";
                }
            default:
                return null;
        }
    }

second:

public static String ConvertClientToServerAdapter(String adapterClient)
{
    switch (adapterClient)
    {
        case "FA":
            {
                return "f";
            }
        case "Gi":
            {
                return "g";
            }
        case "SE":
            {
                return "s";
            }
        case "ATM":
            {
                return "a";
            }
        default:
            return null;
    }
}
  • 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-24T05:04:52+00:00Added an answer on May 24, 2026 at 5:04 am

    You can store the string pairs in a dictionary. That will reduce the duplication of having two places in the code saying that ‘a’ is paired with ‘ATM’.

    For the forward conversion, just index the dictionary. return _dict[adapterServer];.

    Edit: maybe it should be TryGetValue if you want to return null for invalid input, rather than throwing exceptions.

    For backward, use linq:

     return _dict.Elements.FirstOrDefault(e => e.Value == adapterClient).Key);
    

    You can swap what is forward/backward depending on what is used more often, forward dictionary indexing is faster than linq.

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

Sidebar

Related Questions

public static string GetCurrentEmployeeName() { return db.Employees.SingleOrDefault( c => c.NTUserName == CurrentUsername() ).Last_First; }
Consider the following code public class sqldetails extends JFrame implements ActionListener{ static String username=null;
Possible Duplicate: How to capitalize first letter of each sentence? public static string CapitalizeEachWord(this
This is what I'm doing: public static String htmlToText(String inString) { String noentity=StringEscapeUtils.unescapeHtml(inString); return
I am using this method to serialize my object: public static string XmlSerialize(object o)
Assume a method declared as the following: public static string GetString<T>(IEnumerable<T> collection, string theProperty)
I have the following 2 functions: public static string Serialize(object obj) { DataContractSerializer serializer
I'm trying to fetch some webpages using the code below: public static string FetchPage(string
public static String[] removeString (String[] original) { String[] newString; List<String> list = new ArrayList<String>(Arrays.asList(original));
static string IP_Address = ; getIPAddress(); MessageBox.Show(IP_Address); My function is like this: public static

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.