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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:55:54+00:00 2026-06-05T05:55:54+00:00

About Methods’ Syntax: I heard about two syntaxes of parameter declaraton. I use the

  • 0

About Methods’ Syntax:

I heard about two syntaxes of parameter declaraton. I use the first one for MulT and the other one for MulV:

$MathObject = (New-Module {
    function MulT([int]$Factor1, [int]$Factor2) {
        $Factor1 * $Factor2
    }

    function MulV{
        param(
            [int]$Factor1,
            [int]$Factor2
        )
        return $a * $b
    }
} -AsCustomObject)

What’s the difference between the syntax of MulT and the syntax of MulV? Which should I use?

Named Arguments:

Cmdlets can have named arguments:

Multiply-IntegerFactors -Factor1 5 -Factor2 8

Can methods of objects have named arguments too? I’m thinking about something like:

$MathObject.MulT(-Factor1 5, -Factor2 8)

EDIT: Do you think that it’s a good solution to use a hash table as argument in order to store the named arguments there?: $MathObject.MulT(@{Faktor1=5, Faktor2=8}) – Or is there any better solution?

Conventions On Methods:

There are strict naming conventions on Cmdlets (Verb-CamelCaseNoun) and modules (CamelCaseModuleName). Are there any (naming) conventions on methods too?

Thanks.

  • 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-05T05:55:57+00:00Added an answer on June 5, 2026 at 5:55 am

    The difference in how the parameters are declared will make no differences in these 2 functions. In general, you have more flexibility to modify parameters using attributes if you use the param() syntax. There does seem to be an issue with the names of the parameters and how they are referenced in the body of the MulV function ($factor1/2 and $a/$b).

    As far as using named parameters for methods, that doesn’t work.

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

Sidebar

Related Questions

When I first learned about extension methods I read this : In general, we
I am a newbie to python,everywhere I read about list methods I see one
I am curious how other Resharper users deal wih R#'s complaint about virtual methods
I know I'm missing one important rule about static methods but would would be
When verbally talking about methods, I'm never sure whether to use the word argument
I'm talking about methods like -removeAllObjects, -removeLastObject, etc for NSMutableArray. The documentation only says
how to extract RTTI info about methods in Delphi records? is it possible by
I am currently studying recursion in school, and I have trouble thinking about methods
My question is about $wpdb methods in wordpress. Before running these methods for example:
My question is about controller methods (possibly included from an outside class) that work

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.