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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:33:57+00:00 2026-06-06T01:33:57+00:00

I am using postsharp to log method call and i need to log the

  • 0

I am using postsharp to log method call and i need to log the parameter values also.
my problem comes in when i have parameters that are generic lists and i cant iterate through the list to get the values in it.

i know how to check if the parameter is a list but i just cant read through the values in it…

is it possible to read through the list and how would i go about doing this?

for (int i = 0; i < args.Arguments.Count; i++)
            {
                if (methodName == "LogonUser" && i == 1)
                {
                    sb.Append(",********");
                    break;
                }
                else if (i > 0)
                {
                    sb.Append(", ");
                }

                if (args.Arguments[i] is IList && args.Arguments[i].GetType().IsGenericType)
                {

                   //here is where i need to read through the list


                }
                sb.Append(args.Arguments.GetArgument(i) ?? "null");




            }
  • 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-06-06T01:33:58+00:00Added an answer on June 6, 2026 at 1:33 am

    If you only want to iterate through the argument, when its a (generic) list you can
    check the argument if it implements the interface IEnumerable and then loop the values
    in the list with a foreach statement.

    IEnumerable argumentList = args.Arguments[i] as IEnumerable;
    
    if (argumentList != null) {
      foreach(var item in argumentList){
        // Do what you want with the item
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some problem with PostSharp (I assume that problem can be solved by
I have a project that currently compiles happily on my dev machine using VS
Using report builder 3.0, I have a report that queries a cube. How do
Using CRM 4, I have an entity form that contains a tab with an
I am considering using Postsharp framework to ease the burden of application method logging.
So I'm looking at PostSharp and I noticed that this isn't using runtime generated
I have a number of classes that call say Trace.WriteLine(LogSomethingClassSpecific), in various methods all
Using Android 2.1+. I have a service that gets killed from time to time
Using boost python I need create nested namespace. Assume I have following cpp class
I'm using a PostSharp method attribute to do authorisation and auditing on my WCF

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.