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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:34:13+00:00 2026-05-11T17:34:13+00:00

i have 3 Array X,Y,Risk. i added a list generic (listtraining). if i click

  • 0

i have 3 Array X,Y,Risk. i added a list generic (listtraining). if i click buttun Run my codes. But i dont want to use Session to transfer data. in winforms i dont need Session. May List collect data in his memory?

 public partial class _Default : System.Web.UI.Page
    {
        double[] X;
        double[] Y;
        string[] Risk;
        List<KNNAlgorithms.TrainigSet> listtraining;
        protected void Page_Load(object sender, EventArgs e)
        {
            listtraining = new List<KNNAlgorithms.TrainigSet>();
            if (!IsPostBack)
            {


                X = new double[] { 0.08, 0.07, 0.20, 1.00, 0.05, 0.20, 0.17, 0.15, 0.50, 0.10 };
                Y = new double[] { 0.20, 0.07, 0.09, 0.20, 0.06, 0.25, 0.07, 0.55, 0.08, 0.06 };
                Risk = new string[] { "erkek", "erkek", "erkek", "kadın", "erkek", "erkek", "erkek", "kadın", "erkek", "kadın" };

                for (int i = 0; i < X.Length; i++)
                {
                    KNNAlgorithms.TrainigSet tr = new KNNAlgorithms.TrainigSet();

                    tr.X = X[i];
                    tr.Y = Y[i];
                    tr.Risk = Risk[i];
                    listtraining.Add(tr);
                }
                Session.Add("listtraining", listtraining);
                for (int i = 0; i < listtraining.Count; i++)
                {
                    ListBox1.Items.Add(listtraining[i].X.ToString());
                    ListBox2.Items.Add(listtraining[i].Y.ToString());
                    ListBox3.Items.Add(listtraining[i].Risk.ToString());
                }
            }
        }

        protected void btnHesapla_Click(object sender, EventArgs e)
        {
            List<KNNAlgorithms.TrainigSet> listtraining = new List<KNNAlgorithms.TrainigSet>();

            KNNAlgorithms.KNNModel knn = new KNNAlgorithms.KNNModel();
            double x = double.Parse(txtX.Text);
            double y = double.Parse(txtY.Text);
            int k = int.Parse(txtKValue.Text);
            listtraining = (List < KNNAlgorithms.TrainigSet > )Session["listtraining"];
            lblResult.Text = "Üretilen Sonuç:  " + knn.CalculatedDistancesArray(listtraining, x, y, "kadın", "erkek", k);
        }
    }
  • 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-11T17:34:14+00:00Added an answer on May 11, 2026 at 5:34 pm

    The list data needs to be persisted some where and your options on the web are session, viewstate, cache. The data stored in any of these mediums is actually stored in server’s memory.

    The other option is that you serialize the data into XML or plain text [as it may suit you] and store it as a file on the server. This is generally not a good approach however coz you will end up with umpteen files on the file server.

    One more option is to serialize the data, store it in a hidden input element on the form and pass it from page to page where you need it. This will be slightly cumbersome to code & handle overall.

    The best bet i woudl still recommend as a session variable.

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

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can user LTRIM Oracle function: SQL> select ltrim(' hello… May 12, 2026 at 1:13 am
  • Editorial Team
    Editorial Team added an answer Something has gotten out of sync or has become corrupt,… May 12, 2026 at 1:13 am
  • Editorial Team
    Editorial Team added an answer There is no direct way to do this that I'm… May 12, 2026 at 1:13 am

Related Questions

Currently, I'm able to load in a static sized texture which I have created.
A cancer CT picture is stored inside a unsigned short array (1-dimensional). I have
Given an array of 81 elements (meant to represent a 9x9 grid) how can
I've got some library code that works on a range of .NET runtimes (regular,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.