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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:06:56+00:00 2026-05-22T02:06:56+00:00

I am writing an application that will check text entered into a rich text

  • 0

I am writing an application that will check text entered into a rich text box and see if it contains kanji (chinese characters) outside of a specific list.

I am currently using a string array for the 1000 kanji I want to allow and I’m just doing a for loop over each element in the user input and checking to see if the kanji is in the list or not. If it’s not, I return a list at the end of all the ‘not allowed’ kanji.

My questions is, right now I am creating the string array inside the check method that is run when the user hits the ‘check’ button but I’m afraid that means I am creating the 1000 kanji list every time the operation is done. Where and how do I load the 1000 kanji string array so that it’s always loaded into memory? It there any way to just initialize the pre-made list (I have no need to add or remove elements – I’m using it almost like a dictionary).

  • 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-22T02:06:56+00:00Added an answer on May 22, 2026 at 2:06 am

    You’re better of storing the characters in a List collection and use List.Contains to see if a character is on the list:

    var myCharacters = new List<string>();
    // Fill in the list...
    
    if (myCharacters.Contains('?'))
    {
      // Do something
    }
    

    Create and fill in ‘myCharacters’ list only once. Call myCharacters.Contains() method whenever you need to check for a character. Contains() method is optimized so it will be way more performant than your own implementation. Below is a full blown sample:

    internal partial class MyForm : Form
    {
        internal MyForm()
        {
            myCharacters.AddRange(...);
        }
    
        List<string> myCharacters = new List<string>();
    
        private void ValidateButton_Click(object sender, EventArgs e)
        {
            if (myCharacters.Contains('?'))
            {
                // Do something
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am current writing an application that will require multiple inserts, updates and deletes
I'm writing an application that will create difficult passwords for the user. The user
I'm writing an application that will add users to Active Directory. I'm trying to
At the office we are currently writing an application that will generate XML files
I am writing a web application that will run in kiosk mode on a
I'm writing a web application that will have plugins. The plugins will be .DLL
I am writing a PHP application that will have the ability to edit settings
I'm writing a console application that will be deployed with an installation of an
I am writing a Silverlight application that will be both reading and writing data
I'm writing a wrapper application that will be used to provide an abstraction layer

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.