Questions tagged [parameterinfo]
15 questions
                    
                    15
                    
            votes
                
                3 answers
            
        Difference between ParameterInfo.IsOptional and ParameterInfo.HasDefaultValue?
They both sound similar. From msdn:
ParameterInfo.IsOptional
Gets a value indicating whether this parameter is optional.
This method depends on an optional metadata flag. This flag can be
  inserted by compilers, but the compilers are not obligated…
        
        nawfal
        
- 70,104
 - 56
 - 326
 - 368
 
                    8
                    
            votes
                
                3 answers
            
        How to do automatic type conversion for parameters when invoking a method using reflection in C#?
I have a need to invoke methods on a type through reflection using C#.
At run-time, my data will consist of a Dictionary containing name/value pairs. The names in the Dictionary will correspond to parameter names on the method I will invoke. Also,…
        
        Nik Kalyani
        
- 916
 - 5
 - 10
 
                    7
                    
            votes
                
                4 answers
            
        How to determine if ParameterInfo is of generic type?
I have a MethodInfo of a GenericMethodDefinition.  Such as: CallMethod(T arg, string arg2).  The GetParameters() method will give me two ParameterInfo objects, the first of which is generic, the second of which is not.  How can I get… 
        
        smartcaveman
        
- 41,281
 - 29
 - 127
 - 212
 
                    6
                    
            votes
                
                1 answer
            
        ParameterInfo properties, attributes and out ref parameters of the methods
Well, I'm confused by the properties of the ParameterInfo class.
Unfortunately documentation is not very clear: examples show how to build methods but don't show how these methods look in C#.
Cane somebody tell more about these…
        
        Pavel Voronin
        
- 13,503
 - 7
 - 71
 - 137
 
                    3
                    
            votes
                
                1 answer
            
        Assign value to method parameter
Imagine a method with the following signature:
public void ExampleMethod(string id, object data, 
                          ref object A, ref object B, ref object C)
{
  //...
}
The value in data needs to be assigned to either A, B, C or nothing,…
        
        David Rutten
        
- 4,716
 - 6
 - 43
 - 72
 
                    3
                    
            votes
                
                2 answers
            
        How to dereference ParameterType for parameters passed by ref
I have the following code-snippet (it is just an example to point out my problem to which I am finding a solution):
public class Test
{
    public enum myEnum
    {
        myEnum1,
        myEnum2,
    }
    public static void Refer(out int a, int…
        user5218174
                    2
                    
            votes
                
                0 answers
            
        Parameter documentation (info) not showing in Visual Studio Code
I'm just wondering how it is that I can't see the parameter documentation on String.Format (C#) in Visual Studio Code.
Here's the example of Console.WriteLine (using Ctrl+Shift+Space):
Here's the example "not working" using String.Format:
I'm…
        
        pdvries
        
- 1,372
 - 2
 - 9
 - 18
 
                    2
                    
            votes
                
                2 answers
            
        Testing whether a method has a specific signature using Reflection
I'm writing an abstract class which (in its constructor) collects all static methods that adhere to a certain signature. The methods it collects must look like:
static ConversionMerit NAME(TYPE1, out TYPE2, out string)
Where I don't care about…
        
        David Rutten
        
- 4,716
 - 6
 - 43
 - 72
 
                    2
                    
            votes
                
                2 answers
            
        How to determine if a ParameterInfo is a return parameter
How can one determine if a ParameterInfo is a Return Parameter?
I wrote the function below, but I'm concerned that I may be missing something:
public bool IsReturnParameter(ParameterInfo parameter){
    var method = parameter.Member as MethodInfo;
 …
        
        smartcaveman
        
- 41,281
 - 29
 - 127
 - 212
 
                    1
                    
            vote
                
                2 answers
            
        How to tell if ParameterInfo type is a collection?
Is there a way to check whether ParameterInfo is a Collection?
I have tried this:
ConstructorInfo[] constructorInfos = typeof(T).GetConstructors();
ConstructorInfo constructorInfo = constructorInfos[0];
ParameterInfo[] paramsVar =…
        
        DevDave
        
- 6,700
 - 12
 - 65
 - 99
 
                    0
                    
            votes
                
                0 answers
            
        WebStorm huge Parameter Info popup size
Recently I've noticed that when I use Ctrl + P to see parameters in function it creates really huge popup window, but earlier everything was fine
I've pressed Ctrl + P in a function and it created a huge popup window, but I expected little popup.
        
    
                    0
                    
            votes
                
                0 answers
            
        How does CLion show parameters' name when parameter popup in macro?
The parameters' name will appear.
But when it is defined in a marco, it disappeared:
Is here a way to display the name of parameters in macro? or just it is a feature of CLion?
        
    
                    0
                    
            votes
                
                1 answer
            
        How to get the ParameterInfo of a function with variable number of params?
How to get the ParameterInfo of a function with variable number of params?
The problem is when I call the method 
MyFunction(object o1, out object o2);
I can get the parameterInfo of sendData but not the o1 and o2 object.
protected object[]…
        
        BobyFish
        
- 11
 - 7
 
                    0
                    
            votes
                
                1 answer
            
        One method to read parameters, properties and return types at runtime using C#
With continutation to my earlier thread Using reflection read properties of an object containing array of another object. I am hoping to make this wonderful method from EvgK a generic method that can be used in multiple places in my code…
        
        Sri Reddy
        
- 6,832
 - 20
 - 70
 - 112
 
                    0
                    
            votes
                
                1 answer
            
        How to get the method name used in lambda that was passed a parameter
The parameter in the AssertManager.Record is in action but i need the  value inside the lambda action which is the asserts.So i need to get what type of assertion i used which i passed from one class to another. I used lambda expression for certain…
        
        Midnight Phantom
        
- 15
 - 3