Skip to content

Commit ac71099

Browse files
authored
Work to support serialization with full .NET (#200)
***NO_CI***
1 parent 47525b0 commit ac71099

File tree

13 files changed

+55
-38
lines changed

13 files changed

+55
-38
lines changed

nanoFramework.CoreLibrary/System/Boolean.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public struct Boolean
2323

2424
// this field is required in the native end
2525
#pragma warning disable 0649
26-
private bool _value;
26+
// Do not rename (binary serialization)
27+
private bool m_value;
2728
#pragma warning restore 0649
2829

2930
/// <summary>
@@ -32,7 +33,7 @@ public struct Boolean
3233
/// <returns>TrueString if the value of this instance is true, or FalseString if the value of this instance is false.</returns>
3334
public override String ToString()
3435
{
35-
return _value ? TrueString : FalseString;
36+
return m_value ? TrueString : FalseString;
3637
}
3738

3839
}

nanoFramework.CoreLibrary/System/Byte.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public struct Byte
1616
{
1717
// this field is required in the native end
1818
#pragma warning disable 0649
19-
private byte _value;
19+
// Do not rename (binary serialization)
20+
private byte m_value;
2021
#pragma warning restore 0649
2122

2223
/// <summary>
@@ -35,7 +36,7 @@ public struct Byte
3536
/// <remarks>The return value is formatted with the general numeric format specifier ("G") and the NumberFormatInfo object for the thread current culture.</remarks>
3637
public override String ToString()
3738
{
38-
return Number.Format(_value, true, "G", NumberFormatInfo.CurrentInfo);
39+
return Number.Format(m_value, true, "G", NumberFormatInfo.CurrentInfo);
3940
}
4041

4142
/// <summary>
@@ -45,7 +46,7 @@ public override String ToString()
4546
/// <returns>The string representation of the current Byte object, formatted as specified by the format parameter.</returns>
4647
public String ToString(String format)
4748
{
48-
return Number.Format(_value, true, format, NumberFormatInfo.CurrentInfo);
49+
return Number.Format(m_value, true, format, NumberFormatInfo.CurrentInfo);
4950
}
5051

5152
/// <summary>

nanoFramework.CoreLibrary/System/Char.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ public struct Char
1414
{
1515
// this field is required in the native end
1616
#pragma warning disable 0649
17-
private char _value;
17+
// Do not rename (binary serialization)
18+
private char m_value;
1819
#pragma warning restore 0649
1920

2021
/// <summary>
@@ -32,7 +33,7 @@ public struct Char
3233
/// <returns>The string representation of the value of this instance.</returns>
3334
public override String ToString()
3435
{
35-
return new String(_value, 1);
36+
return new String(m_value, 1);
3637
}
3738

3839
/// <summary>
@@ -41,12 +42,12 @@ public override String ToString()
4142
/// <returns>The lower case character.</returns>
4243
public char ToLower()
4344
{
44-
if ('A' <= _value && _value <= 'Z')
45+
if ('A' <= m_value && m_value <= 'Z')
4546
{
46-
return (char)(_value - ('A' - 'a'));
47+
return (char)(m_value - ('A' - 'a'));
4748
}
4849

49-
return _value;
50+
return m_value;
5051
}
5152

5253
/// <summary>
@@ -55,12 +56,12 @@ public char ToLower()
5556
/// <returns>The upper case character.</returns>
5657
public char ToUpper()
5758
{
58-
if ('a' <= _value && _value <= 'z')
59+
if ('a' <= m_value && m_value <= 'z')
5960
{
60-
return (char)(_value + ('A' - 'a'));
61+
return (char)(m_value + ('A' - 'a'));
6162
}
6263

63-
return _value;
64+
return m_value;
6465
}
6566
}
6667
}

nanoFramework.CoreLibrary/System/Double.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public struct Double
2121

2222
// this field is required in the native end
2323
#pragma warning disable 0649
24-
internal double _value;
24+
// Do not rename (binary serialization)
25+
internal double m_value;
2526
#pragma warning restore 0649
2627

2728
/// <summary>
@@ -158,7 +159,7 @@ public string ToString(string format)
158159
return _naNSymbol;
159160
}
160161

161-
return Number.Format(_value, false, format, NumberFormatInfo.CurrentInfo);
162+
return Number.Format(m_value, false, format, NumberFormatInfo.CurrentInfo);
162163
}
163164

164165
/// <summary>

nanoFramework.CoreLibrary/System/Int16.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public struct Int16
1616
{
1717
// this field is required in the native end
1818
#pragma warning disable 0649
19-
internal short _value;
19+
// Do not rename (binary serialization)
20+
internal short m_value;
2021
#pragma warning restore 0649
2122

2223
/// <summary>
@@ -36,7 +37,7 @@ public struct Int16
3637
/// <returns>The string representation of the value of this instance, consisting of a minus sign if the value is negative, and a sequence of digits ranging from 0 to 9 with no leading zeroes.</returns>
3738
public override String ToString()
3839
{
39-
return Number.Format(_value, true, "G", NumberFormatInfo.CurrentInfo);
40+
return Number.Format(m_value, true, "G", NumberFormatInfo.CurrentInfo);
4041
}
4142

4243
/// <summary>
@@ -46,7 +47,7 @@ public override String ToString()
4647
/// <returns>The string representation of the value of this instance as specified by format.</returns>
4748
public String ToString(String format)
4849
{
49-
return Number.Format(_value, true, format, NumberFormatInfo.CurrentInfo);
50+
return Number.Format(m_value, true, format, NumberFormatInfo.CurrentInfo);
5051
}
5152

5253
/// <summary>

nanoFramework.CoreLibrary/System/Int32.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ namespace System
1414
[Serializable]
1515
public struct Int32
1616
{
17-
internal int _value;
17+
// Do not rename (binary serialization)
18+
internal int m_value;
1819

1920
/// <summary>
2021
/// Represents the largest possible value of an Int32. This field is constant.
@@ -33,7 +34,7 @@ public struct Int32
3334
/// <returns>The string representation of the value of this instance, consisting of a negative sign if the value is negative, and a sequence of digits ranging from 0 to 9 with no leading zeroes.</returns>
3435
public override String ToString()
3536
{
36-
return Number.Format(_value, true, "G", NumberFormatInfo.CurrentInfo);
37+
return Number.Format(m_value, true, "G", NumberFormatInfo.CurrentInfo);
3738
}
3839

3940
/// <summary>
@@ -43,7 +44,7 @@ public override String ToString()
4344
/// <returns>he string representation of the value of this instance as specified by format.</returns>
4445
public String ToString(String format)
4546
{
46-
return Number.Format(_value, true, format, NumberFormatInfo.CurrentInfo);
47+
return Number.Format(m_value, true, format, NumberFormatInfo.CurrentInfo);
4748
}
4849

4950
/// <summary>

nanoFramework.CoreLibrary/System/Int64.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ namespace System
1414
[Serializable]
1515
public struct Int64
1616
{
17-
internal long _value;
17+
// Do not rename (binary serialization)
18+
internal long m_value;
1819

1920
/// <summary>
2021
/// Represents the largest possible value of an Int64. This field is constant.
@@ -33,7 +34,7 @@ public struct Int64
3334
/// <returns>The string representation of the value of this instance, consisting of a minus sign if the value is negative, and a sequence of digits ranging from 0 to 9 with no leading zeroes.</returns>
3435
public override String ToString()
3536
{
36-
return Number.Format(_value, true, "G", NumberFormatInfo.CurrentInfo);
37+
return Number.Format(m_value, true, "G", NumberFormatInfo.CurrentInfo);
3738
}
3839

3940
/// <summary>
@@ -43,7 +44,7 @@ public override String ToString()
4344
/// <returns>The string representation of the value of this instance as specified by format.</returns>
4445
public String ToString(String format)
4546
{
46-
return Number.Format(_value, true, format, NumberFormatInfo.CurrentInfo);
47+
return Number.Format(m_value, true, format, NumberFormatInfo.CurrentInfo);
4748
}
4849

4950
/// <summary>

nanoFramework.CoreLibrary/System/SByte.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public struct SByte
1616
{
1717
// this field is required in the native end
1818
#pragma warning disable 0649
19-
private sbyte _value;
19+
// Do not rename (binary serialization)
20+
private sbyte m_value;
2021
#pragma warning restore 0649
2122

2223
/// <summary>
@@ -37,7 +38,7 @@ public struct SByte
3738
/// <returns>The string representation of the value of this instance, consisting of a negative sign if the value is negative, and a sequence of digits ranging from 0 to 9 with no leading zeroes.</returns>
3839
public override String ToString()
3940
{
40-
return Number.Format(_value, true, "G", NumberFormatInfo.CurrentInfo);
41+
return Number.Format(m_value, true, "G", NumberFormatInfo.CurrentInfo);
4142
}
4243

4344
/// <summary>
@@ -47,7 +48,7 @@ public override String ToString()
4748
/// <returns>The string representation of the value of this instance as specified by format.</returns>
4849
public String ToString(String format)
4950
{
50-
return Number.Format(_value, true, format, NumberFormatInfo.CurrentInfo);
51+
return Number.Format(m_value, true, format, NumberFormatInfo.CurrentInfo);
5152
}
5253

5354
/// <summary>

nanoFramework.CoreLibrary/System/Single.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public struct Single
1717
{
1818
// this field is required in the native end
1919
#pragma warning disable 0649
20-
internal float _value;
20+
// Do not rename (binary serialization)
21+
internal float m_value;
2122
#pragma warning restore 0649
2223

2324
/// <summary>
@@ -159,7 +160,7 @@ public string ToString(string format)
159160
return double._naNSymbol;
160161
}
161162

162-
return Number.Format(_value, false, format, NumberFormatInfo.CurrentInfo);
163+
return Number.Format(m_value, false, format, NumberFormatInfo.CurrentInfo);
163164
}
164165

165166
/// <summary>

nanoFramework.CoreLibrary/System/UInt16.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public struct UInt16
1616
{
1717
// this field is required in the native end
1818
#pragma warning disable 0649
19-
private ushort _value;
19+
// Do not rename (binary serialization)
20+
private ushort m_value;
2021
#pragma warning restore 0649
2122

2223
/// <summary>
@@ -36,7 +37,7 @@ public struct UInt16
3637
/// <returns>The string representation of the value of this instance, which consists of a sequence of digits ranging from 0 to 9, without a sign or leading zeros.</returns>
3738
public override String ToString()
3839
{
39-
return Number.Format(_value, true, "G", NumberFormatInfo.CurrentInfo);
40+
return Number.Format(m_value, true, "G", NumberFormatInfo.CurrentInfo);
4041
}
4142

4243
/// <summary>
@@ -46,7 +47,7 @@ public override String ToString()
4647
/// <returns>The string representation of the value of this instance as specified by format.</returns>
4748
public String ToString(String format)
4849
{
49-
return Number.Format(_value, true, format, NumberFormatInfo.CurrentInfo);
50+
return Number.Format(m_value, true, format, NumberFormatInfo.CurrentInfo);
5051
}
5152

5253
/// <summary>

0 commit comments

Comments
 (0)