MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetParameters

Method GetParameters

Source/Editor/Scripting/ScriptType.cs:444–481  ·  view source on GitHub ↗

Gets the method parameters metadata (or event delegate signature parameters).

()

Source from the content-addressed store, hash-verified

442 /// Gets the method parameters metadata (or event delegate signature parameters).
443 /// </summary>
444 public Parameter[] GetParameters()
445 {
446 if (_managed is MethodInfo methodInfo)
447 {
448 var parameters = methodInfo.GetParameters();
449 if (parameters.Length == 0)
450 return Utils.GetEmptyArray<Parameter>();
451 var result = new Parameter[parameters.Length];
452 for (int i = 0; i < result.Length; i++)
453 {
454 var parameter = parameters[i];
455 var p = new Parameter
456 {
457 Name = parameter.Name,
458 Type = new ScriptType(parameter.ParameterType),
459 IsOut = parameter.IsOut,
460 HasDefaultValue = parameter.HasDefaultValue,
461 };
462 if (p.HasDefaultValue)
463 p.DefaultValue = parameter.DefaultValue;
464 var attributes = parameter.GetCustomAttributes();
465 if (attributes is Attribute[] asArray)
466 p.Attributes = asArray;
467 else if (attributes.Count() != 0)
468 p.Attributes = attributes.ToArray();
469 else
470 p.Attributes = null;
471 result[i] = p;
472 }
473 return result;
474 }
475 if (_managed is EventInfo eventInfo)
476 {
477 var invokeMethod = eventInfo.EventHandlerType.GetMethod("Invoke");
478 return new ScriptMemberInfo(invokeMethod).GetParameters();
479 }
480 return _custom.GetParameters();
481 }
482
483 /// <summary>
484 /// Checks if the type is not null.

Callers 15

SerializeMethod · 0.45
GetClassMethodsMethod · 0.45
MarshalHelperMethod · 0.45
GetParameterTypesMethod · 0.45
InvokeMethodNodeMethod · 0.45
IsInputCompatibleMethod · 0.45
IsOutputCompatibleMethod · 0.45

Calls 3

CountMethod · 0.45
ToArrayMethod · 0.45
GetMethodMethod · 0.45

Tested by

no test coverage detected