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

  • Home
  • SEARCH
  • 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 1018833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:55:03+00:00 2026-05-16T10:55:03+00:00

What I am trying to do is create a function that will be called

  • 0

What I am trying to do is create a function that will be called from each method within a .cs file to then get all of the property names and values that are passed to the method and create a string of them.

This will be used for a debug log to show what the value of each property was when the error occurred as an alternative to manually creating the string each time an error occurs.

Is this possible? I have looked at reflection and I think it is what I need but I am not sure about passing the current method from itself into the new function, and then inside of the function pulling the properties of the method out (I assume this is where the reflection comes into play.)

  • 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-16T10:55:04+00:00Added an answer on May 16, 2026 at 10:55 am

    A simpler approach might be to catch the exception, and then only log the values of the properties you’re interested in. Trying to achieve what you want to do using reflection is possibly over-engineering.

    ABC abc = new ABC();
    try {
        a.xyz = "Runtime value";
        //Exception thrown here ...
    }
    catch (Exception ex)
    {    
        Log.LogDebugFormatted(
          "Exception caught. abc.xyz value: {0}. Exception: {1}", abc.xyz, ex);
        throw ex;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 527k
  • Answers 527k
  • 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 If the constructor were private, how would Beta call super(a)?… May 16, 2026 at 10:44 pm
  • Editorial Team
    Editorial Team added an answer You're right, '#container' is looking for an element with the… May 16, 2026 at 10:44 pm
  • Editorial Team
    Editorial Team added an answer In case anyone else has this issue here is the… May 16, 2026 at 10:44 pm

Trending Tags

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

Top Members

Related Questions

I am trying to create a TreeView from the Silverlight TreeView control. I have
I am trying to retrieve information from a web service call. The following is
Objects: Object Sale n Object User will participate on Object Sale Each User can
I am trying to create a jquery plugin to do ajax table pagination (i.e
I'm running up against a problem in understanding the CLOS way of handling file
I am trying to organize my JavaScript. What I would like to do is
I'm trying to optimize up some horrendously complicated SQL queries because it takes too
I am trying to figure out how to dynamically populate textfields in Flash. The
I'm trying to deconstruct part of Gmail and can't seem to be able to
What im trying to do is a little different, im wondering, if its possible

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.