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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:42:31+00:00 2026-05-23T06:42:31+00:00

I have a linq table KUND who is read only to me. It has

  • 0

I have a linq table “KUND” who is read only to me. It has some special characters in it to which i have writter a function to switch them out to the ones i want.

public static string changeSpecialCharacters(string kund)
    {
        StringBuilder b = new StringBuilder(kund);

        b = b.Replace("Õ", "å");
        b = b.Replace("┼", "Å");
        b = b.Replace("õ", "ä");
        b = b.Replace("─", "Ä");
        b = b.Replace("÷", "ö");
        b = b.Replace("Í", "Ö");
        b = b.Replace("'", " ");
        b = b.Replace("¦", "´");
        b = b.Replace("Ï", "Ø");

        return b.ToString();
    }

I now have two questions:

1 Can i add this function to the GET in the autogenerated datacontext so i dont have to call it all over my code? Ive added it but it seems to be deleted whenever i change how my datacontext is (add/remove table). 2 Any suggestions how to make that function better in regards to speed perhaps?

  • 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-23T06:42:32+00:00Added an answer on May 23, 2026 at 6:42 am

    Never edit the .designer.cs; instead, add a second file, and use partial class to add the method, for example:

    namespace Your.Namespace
    {
        partial class YourDataContext
        {
            // your methods here
        }
    }
    

    No; you can’t add this to the get. Another alternative, though, is an extension method:

    namespace Some.Utility.Namespace
    {
        public static class SomeUtilityClass
        {
            public static string ChangeSpecialCharacters(this string kund)
            { ... } // note the "this" in the above line
        }
    }
    

    Now you can use:

    string name = obj.Name.ChangeSpecialCharacters();
    

    personally I would rename this to clarify the direction of the change, and have two methods – one to encode, one to decode.


    Re doing this for a set of data; perhaps:

    public static IEnumerable<SomeType> ChangeSpecialCharacters(
        this IEnumerable<SomeType> items)
    {
        foreach(var item in items)
        {
            item.Name = item.Name.ChangeSpecialCharacters();
            item.Foo = item.Foo.ChangeSpecialCharacters();
            ...
            item.Bar = item.Bar.ChangeSpecialCharacters();
            yield return item;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a LINQ to SQL table that has a field called say
I have a LINQ function that returns a summary table. private DataTable CreateSummaryFocusOfEffortData() {
I have a linq query which presents data that is present in CustomersRecord Table
I have users table, it has id, name last name I have a linq
I have two LINQ table objects calls Orders and ImportedOrders which have exact the
I have a LINQ query which is searching a SQL table of around 250,000
I have a LINQ to SQL class VoucherRecord based on a simple table. One
I have a LINQ to ENTITY query that pulls from a table, but I
I have a stored procedure that updates a table using linq, eg: (this is
I have a BankAccount table. LINQ to SQL generates a class named BankAccount as

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.