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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:32:02+00:00 2026-05-26T11:32:02+00:00

I am passing data to Pages in C# by including a reference to an

  • 0

I am passing data to Pages in C# by including a reference to an object as a parameter in the page’s constructor. I’m only using a portion of the members of the object in the page. A call to such a page looks like so:

new PageName(DataObject);

Where the DataObject set to be the DataContext of the new Page:

this.DataContext = DataObject;

From which I can perform all data operations I need to do on DataObject. One key feature with this setup is that changes made to the DataContext affect the passed DataObject; this is intended and desirable.

This is fairly simple and works well for now. One concern i have is that PageName must know to cast DataContext to the correct object type, and must know the names of object properties, creating significant coupling. Is this generally an acceptable level of coupling, or would it be worth the effort to pass ref parameters to reduce the magnitude of coupling between PageName and DataObject?

Edit: On average, if I were passing parameters, I would usually need to pass 4-5 parameters to each page. Not every page needs the same parameters passed to it.

  • 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-26T11:32:02+00:00Added an answer on May 26, 2026 at 11:32 am

    There is a refactoring called introduce parameter object.

    The fact that it exists points to having an object instead of multiple parameters as being the more maintainable option.

    This is a pattern used in the framework in multiple places – see Process and ProcessStartInfo – when an object can be configured multiple ways, supplying a configuration object (yes, that is tightly coupled to the object) is one design decision.

    If the configuration object is only to be used with the object it configures, I don’t really see a problem with this coupling.

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

Sidebar

Related Questions

I'm passing data between my controller and my view using a ViewModel class. When
passing post data using cURL requires that the name of the input. However, I
I am using the FormsAuthenticationTicket and place the data and passing the data across
I'm passing structured data to my MVC page when it loads initially. After the
I have a set of php processing pages that interact together by passing data
I've recently faced a problem involving passing data (small amount), from a page to
I have a vbscript using the InternetExplorer object to navigate to a few pages
Possible Duplicate: Passing data between asp.net pages how to pass value of TEXTBOX from
My question is about passing data from kernel to a user space program. I
What's the advantage of passing data as parameters vs part of the URL in

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.