Skip to the content.

< Back


MyParameterModifiers

Namespace: MyClassLib

Showcases ref, in, out, params parameter modifiers and default parameter values.

public class MyParameterModifiers

Inheritance ObjectMyParameterModifiers
Attributes NullableContextAttribute, NullableAttribute

Constructors

MyParameterModifiers()

public MyParameterModifiers()

Methods

RefIncrement(ref Int32)

Increments a value by reference.

public void RefIncrement(ref int value)

Parameters

ref value Int32
The reference-passed value.

Read(in Int32)

Reads a value via in.

public int Read(in int value)

Parameters

in value Int32
The read-only reference.

Returns

Int32
The value squared.

TryParse(String, out Int32)

Tries to parse a value, writing the parsed result via out.

public bool TryParse(string input, out int value)

Parameters

input String
The text to parse.

out value Int32
The parsed value.

Returns

Boolean
on success.

Join(params String[])

Concatenates a variable number of items.

public string Join(params String[] items)

Parameters

params items String[]
The items to join.

Returns

String
The joined string.

Defaults(String, Int32, Double, Boolean, MyEnum, String)

Shows several default-value flavours.

public void Defaults(string name = "anakin", int count = 42, double ratio = 1.5d, bool flag = true, MyEnum kind = MyEnum.First, string? note = null)

Parameters

name String
A string default.

count Int32
A numeric default.

ratio Double
A double default.

flag Boolean
A bool default.

kind MyEnum
An enum default.

note String?
A nullable-reference default of .


< Back