Skip to content

Commit ae49470

Browse files
committed
Add reflection helper API, enum extensions, and cleanup
Introduced new reflection helper extensions and interfaces for .NET symbol metadata, including methods for generating readable signatures, checking symbol characteristics, and HTML encoding. Added EnumHelperExtensions for enum display and comparison utilities. Updated README and codebase to use direct member access (removed this. prefixes) for clarity and consistency. Refactored test and example code, and added usage samples for new APIs. These changes improve code style, documentation, and provide a robust, extensible reflection API.
1 parent cdc8d38 commit ae49470

227 files changed

Lines changed: 14845 additions & 14736 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎BionicCode.Net/.editorconfig‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ dotnet_separate_import_directive_groups = false
175175
dotnet_sort_system_directives_first = true
176176
file_header_template = unset
177177

178-
# this. and Me. preferences
178+
# and Me. preferences
179179
dotnet_style_qualification_for_event = false
180180
dotnet_style_qualification_for_field = false
181181
dotnet_style_qualification_for_method = false
@@ -219,7 +219,7 @@ dotnet_style_prefer_simplified_interpolation = true
219219
dotnet_style_readonly_field = true:error
220220

221221
# Parameter preferences
222-
dotnet_code_quality_unused_parameters = all:error
222+
dotnet_code_quality_unused_parameters = all:suggestion
223223

224224
# Suppression preferences
225225
dotnet_remove_unnecessary_suppression_exclusions = none

‎BionicCode.Net/BionicCode.SIUnits.Core/Class1.cs‎

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -10,91 +10,91 @@ public readonly struct SIBaseDimensions
1010
public SIBaseDimensions IncrementLengthExponent(int increment)
1111
{
1212
return new SIBaseDimensions(
13-
this.LengthExponent + increment,
14-
this.MassExponent,
15-
this.TimeExponent,
16-
this.ElectricCurrentExponent,
17-
this.ThermodynamicTemperatureExponent,
18-
this.AmountOfSubstanceExponent,
19-
this.LuminousIntensityExponent
13+
LengthExponent + increment,
14+
MassExponent,
15+
TimeExponent,
16+
ElectricCurrentExponent,
17+
ThermodynamicTemperatureExponent,
18+
AmountOfSubstanceExponent,
19+
LuminousIntensityExponent
2020
);
2121
}
2222

2323
public SIBaseDimensions IncrementMassExponent(int increment)
2424
{
2525
return new SIBaseDimensions(
26-
this.LengthExponent,
27-
this.MassExponent + increment,
28-
this.TimeExponent,
29-
this.ElectricCurrentExponent,
30-
this.ThermodynamicTemperatureExponent,
31-
this.AmountOfSubstanceExponent,
32-
this.LuminousIntensityExponent
26+
LengthExponent,
27+
MassExponent + increment,
28+
TimeExponent,
29+
ElectricCurrentExponent,
30+
ThermodynamicTemperatureExponent,
31+
AmountOfSubstanceExponent,
32+
LuminousIntensityExponent
3333
);
3434
}
3535

3636
public SIBaseDimensions IncrementTimeExponent(int increment)
3737
{
3838
return new SIBaseDimensions(
39-
this.LengthExponent,
40-
this.MassExponent,
41-
this.TimeExponent + increment,
42-
this.ElectricCurrentExponent,
43-
this.ThermodynamicTemperatureExponent,
44-
this.AmountOfSubstanceExponent,
45-
this.LuminousIntensityExponent
39+
LengthExponent,
40+
MassExponent,
41+
TimeExponent + increment,
42+
ElectricCurrentExponent,
43+
ThermodynamicTemperatureExponent,
44+
AmountOfSubstanceExponent,
45+
LuminousIntensityExponent
4646
);
4747
}
4848

4949
public SIBaseDimensions IncrementElectricCurrentExponent(int increment)
5050
{
5151
return new SIBaseDimensions(
52-
this.LengthExponent,
53-
this.MassExponent,
54-
this.TimeExponent,
55-
this.ElectricCurrentExponent + increment,
56-
this.ThermodynamicTemperatureExponent,
57-
this.AmountOfSubstanceExponent,
58-
this.LuminousIntensityExponent
52+
LengthExponent,
53+
MassExponent,
54+
TimeExponent,
55+
ElectricCurrentExponent + increment,
56+
ThermodynamicTemperatureExponent,
57+
AmountOfSubstanceExponent,
58+
LuminousIntensityExponent
5959
);
6060
}
6161

6262
public SIBaseDimensions IncrementThermodynamicTemperatureExponent(int increment)
6363
{
6464
return new SIBaseDimensions(
65-
this.LengthExponent,
66-
this.MassExponent,
67-
this.TimeExponent,
68-
this.ElectricCurrentExponent,
69-
this.ThermodynamicTemperatureExponent + increment,
70-
this.AmountOfSubstanceExponent,
71-
this.LuminousIntensityExponent
65+
LengthExponent,
66+
MassExponent,
67+
TimeExponent,
68+
ElectricCurrentExponent,
69+
ThermodynamicTemperatureExponent + increment,
70+
AmountOfSubstanceExponent,
71+
LuminousIntensityExponent
7272
);
7373
}
7474

7575
public SIBaseDimensions IncrementAmountOfSubstanceExponent(int increment)
7676
{
7777
return new SIBaseDimensions(
78-
this.LengthExponent,
79-
this.MassExponent,
80-
this.TimeExponent,
81-
this.ElectricCurrentExponent,
82-
this.ThermodynamicTemperatureExponent,
83-
this.AmountOfSubstanceExponent + increment,
84-
this.LuminousIntensityExponent
78+
LengthExponent,
79+
MassExponent,
80+
TimeExponent,
81+
ElectricCurrentExponent,
82+
ThermodynamicTemperatureExponent,
83+
AmountOfSubstanceExponent + increment,
84+
LuminousIntensityExponent
8585
);
8686
}
8787

8888
public SIBaseDimensions IncrementLuminousIntensityExponent(int increment)
8989
{
9090
return new SIBaseDimensions(
91-
this.LengthExponent,
92-
this.MassExponent,
93-
this.TimeExponent,
94-
this.ElectricCurrentExponent,
95-
this.ThermodynamicTemperatureExponent,
96-
this.AmountOfSubstanceExponent,
97-
this.LuminousIntensityExponent + increment
91+
LengthExponent,
92+
MassExponent,
93+
TimeExponent,
94+
ElectricCurrentExponent,
95+
ThermodynamicTemperatureExponent,
96+
AmountOfSubstanceExponent,
97+
LuminousIntensityExponent + increment
9898
);
9999
}
100100

@@ -106,44 +106,44 @@ public SIBaseDimensions IncrementLuminousIntensityExponent(int increment)
106106
public SIBaseDimensions DecrementAmountOfSubstanceExponent(int decrement) => IncrementAmountOfSubstanceExponent(-decrement);
107107
public SIBaseDimensions DecrementLuminousIntensityExponent(int decrement) => IncrementLuminousIntensityExponent(-decrement);
108108

109-
public SIBaseDimensions MoveLengthToDenominator() => this with { LengthExponent = -Math.Abs(this.LengthExponent) };
110-
public SIBaseDimensions MoveMassToDenominator() => this with { MassExponent = -Math.Abs(this.MassExponent) };
111-
public SIBaseDimensions MoveTimeToDenominator() => this with { TimeExponent = -Math.Abs(this.TimeExponent) };
112-
public SIBaseDimensions MoveElectricCurrentToDenominator() => this with { ElectricCurrentExponent = -Math.Abs(this.ElectricCurrentExponent) };
113-
public SIBaseDimensions MoveThermodynamicTemperatureToDenominator() => this with { ThermodynamicTemperatureExponent = -Math.Abs(this.ThermodynamicTemperatureExponent) };
114-
public SIBaseDimensions MoveAmountOfSubstanceToDenominator() => this with { AmountOfSubstanceExponent = -Math.Abs(this.AmountOfSubstanceExponent) };
115-
public SIBaseDimensions MoveLuminousIntensityToDenominator() => this with { LuminousIntensityExponent = -Math.Abs(this.LuminousIntensityExponent) };
109+
public SIBaseDimensions MoveLengthToDenominator() => this with { LengthExponent = -Math.Abs(LengthExponent) };
110+
public SIBaseDimensions MoveMassToDenominator() => this with { MassExponent = -Math.Abs(MassExponent) };
111+
public SIBaseDimensions MoveTimeToDenominator() => this with { TimeExponent = -Math.Abs(TimeExponent) };
112+
public SIBaseDimensions MoveElectricCurrentToDenominator() => this with { ElectricCurrentExponent = -Math.Abs(ElectricCurrentExponent) };
113+
public SIBaseDimensions MoveThermodynamicTemperatureToDenominator() => this with { ThermodynamicTemperatureExponent = -Math.Abs(ThermodynamicTemperatureExponent) };
114+
public SIBaseDimensions MoveAmountOfSubstanceToDenominator() => this with { AmountOfSubstanceExponent = -Math.Abs(AmountOfSubstanceExponent) };
115+
public SIBaseDimensions MoveLuminousIntensityToDenominator() => this with { LuminousIntensityExponent = -Math.Abs(LuminousIntensityExponent) };
116116

117117
public SIBaseDimensions MoveAllToDenominator()
118118
{
119119
return new SIBaseDimensions(
120-
-Math.Abs(this.LengthExponent),
121-
-Math.Abs(this.MassExponent),
122-
-Math.Abs(this.TimeExponent),
123-
-Math.Abs(this.ElectricCurrentExponent),
124-
-Math.Abs(this.ThermodynamicTemperatureExponent),
125-
-Math.Abs(this.AmountOfSubstanceExponent),
126-
-Math.Abs(this.LuminousIntensityExponent)
120+
-Math.Abs(LengthExponent),
121+
-Math.Abs(MassExponent),
122+
-Math.Abs(TimeExponent),
123+
-Math.Abs(ElectricCurrentExponent),
124+
-Math.Abs(ThermodynamicTemperatureExponent),
125+
-Math.Abs(AmountOfSubstanceExponent),
126+
-Math.Abs(LuminousIntensityExponent)
127127
);
128128
}
129129

130-
public SIBaseDimensions MoveLengthToNumerator() => this with { LengthExponent = Math.Abs(this.LengthExponent) };
131-
public SIBaseDimensions MoveMassToNumerator() => this with { MassExponent = Math.Abs(this.MassExponent) };
132-
public SIBaseDimensions MoveTimeToNumerator() => this with { TimeExponent = Math.Abs(this.TimeExponent) };
133-
public SIBaseDimensions MoveElectricCurrentToNumerator() => this with { ElectricCurrentExponent = Math.Abs(this.ElectricCurrentExponent) };
134-
public SIBaseDimensions MoveThermodynamicTemperatureToNumerator() => this with { ThermodynamicTemperatureExponent = Math.Abs(this.ThermodynamicTemperatureExponent) };
135-
public SIBaseDimensions MoveAmountOfSubstanceToNumerator() => this with { AmountOfSubstanceExponent = Math.Abs(this.AmountOfSubstanceExponent) };
136-
public SIBaseDimensions MoveLuminousIntensityToNumerator() => this with { LuminousIntensityExponent = Math.Abs(this.LuminousIntensityExponent) };
130+
public SIBaseDimensions MoveLengthToNumerator() => this with { LengthExponent = Math.Abs(LengthExponent) };
131+
public SIBaseDimensions MoveMassToNumerator() => this with { MassExponent = Math.Abs(MassExponent) };
132+
public SIBaseDimensions MoveTimeToNumerator() => this with { TimeExponent = Math.Abs(TimeExponent) };
133+
public SIBaseDimensions MoveElectricCurrentToNumerator() => this with { ElectricCurrentExponent = Math.Abs(ElectricCurrentExponent) };
134+
public SIBaseDimensions MoveThermodynamicTemperatureToNumerator() => this with { ThermodynamicTemperatureExponent = Math.Abs(ThermodynamicTemperatureExponent) };
135+
public SIBaseDimensions MoveAmountOfSubstanceToNumerator() => this with { AmountOfSubstanceExponent = Math.Abs(AmountOfSubstanceExponent) };
136+
public SIBaseDimensions MoveLuminousIntensityToNumerator() => this with { LuminousIntensityExponent = Math.Abs(LuminousIntensityExponent) };
137137
public SIBaseDimensions MoveAllToNumerator()
138138
{
139139
return new SIBaseDimensions(
140-
Math.Abs(this.LengthExponent),
141-
Math.Abs(this.MassExponent),
142-
Math.Abs(this.TimeExponent),
143-
Math.Abs(this.ElectricCurrentExponent),
144-
Math.Abs(this.ThermodynamicTemperatureExponent),
145-
Math.Abs(this.AmountOfSubstanceExponent),
146-
Math.Abs(this.LuminousIntensityExponent)
140+
Math.Abs(LengthExponent),
141+
Math.Abs(MassExponent),
142+
Math.Abs(TimeExponent),
143+
Math.Abs(ElectricCurrentExponent),
144+
Math.Abs(ThermodynamicTemperatureExponent),
145+
Math.Abs(AmountOfSubstanceExponent),
146+
Math.Abs(LuminousIntensityExponent)
147147
);
148148
}
149149

@@ -164,13 +164,13 @@ public SIBaseDimensions(
164164
int amountOfSubstanceExponent,
165165
int luminousIntensityExponent)
166166
{
167-
this.LengthExponent = lengthExponent;
168-
this.MassExponent = massExponent;
169-
this.TimeExponent = timeExponent;
170-
this.ElectricCurrentExponent = electricCurrentExponent;
171-
this.ThermodynamicTemperatureExponent = thermodynamicTemperatureExponent;
172-
this.AmountOfSubstanceExponent = amountOfSubstanceExponent;
173-
this.LuminousIntensityExponent = luminousIntensityExponent;
167+
LengthExponent = lengthExponent;
168+
MassExponent = massExponent;
169+
TimeExponent = timeExponent;
170+
ElectricCurrentExponent = electricCurrentExponent;
171+
ThermodynamicTemperatureExponent = thermodynamicTemperatureExponent;
172+
AmountOfSubstanceExponent = amountOfSubstanceExponent;
173+
LuminousIntensityExponent = luminousIntensityExponent;
174174
}
175175
}
176176

‎BionicCode.Net/BionicCode.SIUnits.Core/NominatorDimensions.cs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ public class NominatorDimensions : List<DimensionInfo>
1010
{
1111
public DimensionInfo(SIBaseDimension siBaseDimension, int exponent)
1212
{
13-
this.SIBaseDimension = siBaseDimension;
14-
this.Exponent = exponent;
13+
SIBaseDimension = siBaseDimension;
14+
Exponent = exponent;
1515
}
1616

1717
public SIBaseDimension SIBaseDimension { get; }
1818
public int Exponent { get; }
1919

2020
public bool Equals(DimensionInfo other)
21-
=> this.SIBaseDimension == other.SIBaseDimension && this.Exponent == other.Exponent;
21+
=> SIBaseDimension == other.SIBaseDimension && Exponent == other.Exponent;
2222

2323
public override bool Equals([NotNullWhen(true)] object? obj)
2424
=> obj is DimensionInfo other && Equals(other);
2525

2626
public override int GetHashCode()
27-
=> HashCode.Combine(this.SIBaseDimension, this.Exponent);
27+
=> HashCode.Combine(SIBaseDimension, Exponent);
2828

2929
public override string? ToString() => base.ToString();
3030

0 commit comments

Comments
 (0)