Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
This commit is contained in:
Ben Adams 2018-08-20 17:25:47 +01:00 коммит произвёл Jan Kotas
Родитель 0c2f36bf04
Коммит 285ffeaf9e
6 изменённых файлов: 24 добавлений и 25 удалений

Просмотреть файл

@ -804,7 +804,7 @@ namespace System.Globalization
} }
} }
result.parsedTimeSpan._ticks = ticks; result.parsedTimeSpan = new TimeSpan(ticks);
return true; return true;
} }
@ -932,7 +932,7 @@ namespace System.Globalization
} }
} }
result.parsedTimeSpan._ticks = ticks; result.parsedTimeSpan = new TimeSpan(ticks);
return true; return true;
} }
@ -1058,7 +1058,7 @@ namespace System.Globalization
} }
} }
result.parsedTimeSpan._ticks = ticks; result.parsedTimeSpan = new TimeSpan(ticks);
return true; return true;
} }
@ -1130,7 +1130,7 @@ namespace System.Globalization
} }
} }
result.parsedTimeSpan._ticks = ticks; result.parsedTimeSpan = new TimeSpan(ticks);
return true; return true;
} }
@ -1200,7 +1200,7 @@ namespace System.Globalization
} }
} }
result.parsedTimeSpan._ticks = ticks; result.parsedTimeSpan = new TimeSpan(ticks);
return true; return true;
} }
@ -1399,7 +1399,7 @@ namespace System.Globalization
ticks = -ticks; ticks = -ticks;
} }
result.parsedTimeSpan._ticks = ticks; result.parsedTimeSpan = new TimeSpan(ticks);
return true; return true;
} }
else else
@ -1494,7 +1494,7 @@ namespace System.Globalization
internal bool TryParse(ReadOnlySpan<char> input, ref TimeSpanResult result) internal bool TryParse(ReadOnlySpan<char> input, ref TimeSpanResult result)
{ {
result.parsedTimeSpan._ticks = 0; result.parsedTimeSpan = default;
_str = input; _str = input;
_len = input.Length; _len = input.Length;
@ -1563,7 +1563,7 @@ namespace System.Globalization
return result.SetBadTimeSpanFailure(); return result.SetBadTimeSpanFailure();
} }
result.parsedTimeSpan._ticks = time; result.parsedTimeSpan = new TimeSpan(time);
return true; return true;
} }

Просмотреть файл

@ -4,12 +4,12 @@
namespace System.Runtime.InteropServices namespace System.Runtime.InteropServices
{ {
public struct HandleRef public readonly struct HandleRef
{ {
// ! Do not add or rearrange fields as the EE depends on this layout. // ! Do not add or rearrange fields as the EE depends on this layout.
//------------------------------------------------------------------ //------------------------------------------------------------------
private object _wrapper; private readonly object _wrapper;
private IntPtr _handle; private readonly IntPtr _handle;
//------------------------------------------------------------------ //------------------------------------------------------------------
public HandleRef(object wrapper, IntPtr handle) public HandleRef(object wrapper, IntPtr handle)

Просмотреть файл

@ -7,11 +7,11 @@ using System.Diagnostics;
namespace System.Runtime.Serialization namespace System.Runtime.Serialization
{ {
public struct SerializationEntry public readonly struct SerializationEntry
{ {
private string _name; private readonly string _name;
private object _value; private readonly object _value;
private Type _type; private readonly Type _type;
internal SerializationEntry(string entryName, object entryValue, Type entryType) internal SerializationEntry(string entryName, object entryValue, Type entryType)
{ {

Просмотреть файл

@ -62,11 +62,11 @@ namespace System
} }
// Helper to allow sharing all code via IComparable<T> inlineable // Helper to allow sharing all code via IComparable<T> inlineable
internal struct ComparerComparable<T, TComparer> : IComparable<T> internal readonly struct ComparerComparable<T, TComparer> : IComparable<T>
where TComparer : IComparer<T> where TComparer : IComparer<T>
{ {
readonly T _value; private readonly T _value;
readonly TComparer _comparer; private readonly TComparer _comparer;
public ComparerComparable(T value, TComparer comparer) public ComparerComparable(T value, TComparer comparer)
{ {

Просмотреть файл

@ -86,19 +86,18 @@ namespace System.Threading
void OnValueChanged(object previousValue, object currentValue, bool contextChanged); void OnValueChanged(object previousValue, object currentValue, bool contextChanged);
} }
public struct AsyncLocalValueChangedArgs<T> public readonly struct AsyncLocalValueChangedArgs<T>
{ {
public T PreviousValue { get; private set; } public T PreviousValue { get; }
public T CurrentValue { get; private set; } public T CurrentValue { get; }
// //
// If the value changed because we changed to a different ExecutionContext, this is true. If it changed // If the value changed because we changed to a different ExecutionContext, this is true. If it changed
// because someone set the Value property, this is false. // because someone set the Value property, this is false.
// //
public bool ThreadContextChanged { get; private set; } public bool ThreadContextChanged { get; }
internal AsyncLocalValueChangedArgs(T previousValue, T currentValue, bool contextChanged) internal AsyncLocalValueChangedArgs(T previousValue, T currentValue, bool contextChanged)
: this()
{ {
PreviousValue = previousValue; PreviousValue = previousValue;
CurrentValue = currentValue; CurrentValue = currentValue;

Просмотреть файл

@ -28,7 +28,7 @@ namespace System
// an appropriate custom ILMarshaler to keep WInRT interop scenarios enabled. // an appropriate custom ILMarshaler to keep WInRT interop scenarios enabled.
// //
[Serializable] [Serializable]
public struct TimeSpan : IComparable, IComparable<TimeSpan>, IEquatable<TimeSpan>, IFormattable, ISpanFormattable public readonly struct TimeSpan : IComparable, IComparable<TimeSpan>, IEquatable<TimeSpan>, IFormattable, ISpanFormattable
{ {
public const long TicksPerMillisecond = 10000; public const long TicksPerMillisecond = 10000;
private const double MillisecondsPerTick = 1.0 / TicksPerMillisecond; private const double MillisecondsPerTick = 1.0 / TicksPerMillisecond;
@ -65,7 +65,7 @@ namespace System
// internal so that DateTime doesn't have to call an extra get // internal so that DateTime doesn't have to call an extra get
// method for some arithmetic operations. // method for some arithmetic operations.
internal long _ticks; // Do not rename (binary serialization) internal readonly long _ticks; // Do not rename (binary serialization)
public TimeSpan(long ticks) public TimeSpan(long ticks)
{ {