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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:37:54+00:00 2026-05-26T12:37:54+00:00

Good Morning. Came across code implemented by someone else and I’m not understanding how

  • 0

Good Morning. Came across code implemented by someone else and I’m not understanding how the FormCollection is used. Is the FormCollection merely a collection of the controls on the form?

        public Email(FormCollection fc)
        {
            StringBuilder sb = new StringBuilder();
            this.fc = fc;
            string[] keys = fc.AllKeys;

            sb.Append("Category,\"REQUEST\",<br />");
            sb.Append("Type,\"TEST EXPRS\",<br />");
         }
  • 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-26T12:37:55+00:00Added an answer on May 26, 2026 at 12:37 pm

    In this particular code snippet it is not used and completely unnecessary as argument.

    Personally I never use FormCollection in ASP.NET MVC applications. I always prefer to define a view model and have the controller action take this view model as argument. Its properties will be automatically populated by the default model binder. For example:

    public class MyViewModel
    {
        public string Property1 { get; set; }
        public int Property2 { get; set; }
        ...
    }
    

    and then:

    public Email(MyViewModel model)
    {
        // use the view model here
        ...
    }
    

    But back to your question: FormCollection represents a key value pair of all POSTed values. It is weakly typed and the values are always string meaning that you will have to manually convert them to their underlying type if you wanted to manipulate them. Try to avoid it.

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

Sidebar

Related Questions

Good morning, I would like the code in my controller to look something like
good morning. i am not a computer scientist by education, so please overlook any
Good morning, afternoon or night, Foreword: The code below does nothing really useful. It
Good morning folks, just wanted to check if someone can help me with the
Good morning in my timezone. Those are simple questions , i just do not
Good morning, I am about to start writing an Excel add-in for Excel 2002.
Good morning. I have an XML file which contains lists of warning and errors
Good morning, I am the developer of a medium sized PDA application that will
Good morning, I work in a small shop (only two of us) and we
Good morning, I am working on a C# winform application that is using validation

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.