Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
18 changes: 9 additions & 9 deletions src/System.Private.CoreLib/Common/System/SR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private static bool UsingResourceKeys()
// Needed for debugger integration
internal static string GetResourceString(string resourceKey)
{
return GetResourceString(resourceKey, String.Empty);
return GetResourceString(resourceKey, string.Empty);
}

internal static string GetResourceString(string resourceKey, string defaultString)
Expand Down Expand Up @@ -155,10 +155,10 @@ internal static string Format(string resourceFormat, params object[] args)
{
if (UsingResourceKeys())
{
return resourceFormat + String.Join(", ", args);
return resourceFormat + string.Join(", ", args);
}

return String.Format(resourceFormat, args);
return string.Format(resourceFormat, args);
}

return resourceFormat;
Expand All @@ -168,29 +168,29 @@ internal static string Format(string resourceFormat, object p1)
{
if (UsingResourceKeys())
{
return String.Join(", ", resourceFormat, p1);
return string.Join(", ", resourceFormat, p1);
}

return String.Format(resourceFormat, p1);
return string.Format(resourceFormat, p1);
}

internal static string Format(string resourceFormat, object p1, object p2)
{
if (UsingResourceKeys())
{
return String.Join(", ", resourceFormat, p1, p2);
return string.Join(", ", resourceFormat, p1, p2);
}

return String.Format(resourceFormat, p1, p2);
return string.Format(resourceFormat, p1, p2);
}

internal static string Format(string resourceFormat, object p1, object p2, object p3)
{
if (UsingResourceKeys())
{
return String.Join(", ", resourceFormat, p1, p2, p3);
return string.Join(", ", resourceFormat, p1, p2, p3);
}
return String.Format(resourceFormat, p1, p2, p3);
return string.Format(resourceFormat, p1, p2, p3);
}
}
}
20 changes: 10 additions & 10 deletions src/System.Private.CoreLib/shared/System/ArgumentException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace System
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public class ArgumentException : SystemException
{
private String _paramName;
private string _paramName;

// Creates a new ArgumentException with its message
// string set to the empty string.
Expand All @@ -36,26 +36,26 @@ public ArgumentException()
// Creates a new ArgumentException with its message
// string set to message.
//
public ArgumentException(String message)
public ArgumentException(string message)
: base(message)
{
HResult = HResults.COR_E_ARGUMENT;
}

public ArgumentException(String message, Exception innerException)
public ArgumentException(string message, Exception innerException)
: base(message, innerException)
{
HResult = HResults.COR_E_ARGUMENT;
}

public ArgumentException(String message, String paramName, Exception innerException)
public ArgumentException(string message, string paramName, Exception innerException)
: base(message, innerException)
{
_paramName = paramName;
HResult = HResults.COR_E_ARGUMENT;
}

public ArgumentException(String message, String paramName)
public ArgumentException(string message, string paramName)
: base(message)
{
_paramName = paramName;
Expand All @@ -74,22 +74,22 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont
info.AddValue("ParamName", _paramName, typeof(string));
}

public override String Message
public override string Message
{
get
{
String s = base.Message;
if (!String.IsNullOrEmpty(_paramName))
string s = base.Message;
if (!string.IsNullOrEmpty(_paramName))
{
String resourceString = SR.Format(SR.Arg_ParamName_Name, _paramName);
string resourceString = SR.Format(SR.Arg_ParamName_Name, _paramName);
return s + Environment.NewLine + resourceString;
}
else
return s;
}
}

public virtual String ParamName
public virtual string ParamName
{
get { return _paramName; }
}
Expand Down
2 changes: 1 addition & 1 deletion src/System.Private.CoreLib/shared/System/ArraySegment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ bool ICollection<T>.Contains(T item)
bool ICollection<T>.Remove(T item)
{
ThrowHelper.ThrowNotSupportedException();
return default(bool);
return default;
}
#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Runtime;
using System.Runtime.InteropServices;

namespace System.Buffers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Runtime;
using System.Runtime.CompilerServices;

namespace System.Buffers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void ICollection.CopyTo(Array array, int index)
/// cref="ICollection"/>. This property is not supported.
/// </summary>
/// <exception cref="NotSupportedException">The SyncRoot property is not supported.</exception>
object ICollection.SyncRoot { get { ThrowHelper.ThrowNotSupportedException(ExceptionResource.ConcurrentCollection_SyncRoot_NotSupported); return default(object); } }
object ICollection.SyncRoot { get { ThrowHelper.ThrowNotSupportedException(ExceptionResource.ConcurrentCollection_SyncRoot_NotSupported); return default; } }

/// <summary>Returns an enumerator that iterates through a collection.</summary>
/// <returns>An <see cref="IEnumerator"/> that can be used to iterate through the collection.</returns>
Expand Down Expand Up @@ -713,7 +713,7 @@ private bool TryDequeueSlow(out T item)
// check and this check, another item could have arrived).
if (head._nextSegment == null)
{
item = default(T);
item = default;
return false;
}

Expand Down Expand Up @@ -807,7 +807,7 @@ private bool TryPeek(out T result, bool resultUsed)
// and we'll traverse to that segment.
}

result = default(T);
result = default;
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/System.Private.CoreLib/shared/System/Convert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public static Object ChangeType(Object value, Type conversionType)

public static Object ChangeType(Object value, Type conversionType, IFormatProvider provider)
{
if (ReferenceEquals(conversionType, null))
if (conversionType is null)
{
throw new ArgumentNullException(nameof(conversionType));
}
Expand Down Expand Up @@ -2008,7 +2008,7 @@ public static string ToString(Object value, IFormatProvider provider)
IFormattable formattable = value as IFormattable;
if (formattable != null)
return formattable.ToString(null, provider);
return value == null ? String.Empty : value.ToString();
return value == null ? string.Empty : value.ToString();
}

public static string ToString(bool value)
Expand Down
6 changes: 3 additions & 3 deletions src/System.Private.CoreLib/shared/System/DateTimeOffset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ public static Boolean TryParse(String input, IFormatProvider formatProvider, Dat
styles = ValidateStyles(styles, nameof(styles));
if (input == null)
{
result = default(DateTimeOffset);
result = default;
return false;
}

Expand Down Expand Up @@ -835,7 +835,7 @@ public static Boolean TryParseExact(String input, String format, IFormatProvider
styles = ValidateStyles(styles, nameof(styles));
if (input == null || format == null)
{
result = default(DateTimeOffset);
result = default;
return false;
}

Expand Down Expand Up @@ -866,7 +866,7 @@ public static Boolean TryParseExact(String input, String[] formats, IFormatProvi
styles = ValidateStyles(styles, nameof(styles));
if (input == null)
{
result = default(DateTimeOffset);
result = default;
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, IntPtr even
List<object> dataRefObj = new List<object>(s_etwAPIMaxRefObjCount);
EventData* userData = stackalloc EventData[2 * argCount];
for (int i = 0; i < 2 * argCount; i++)
userData[i] = default(EventData);
userData[i] = default;
EventData* userDataPtr = (EventData*)userData;
byte* dataBuffer = stackalloc byte[s_basicTypeAllocationBufferSize * 2 * argCount]; // Assume 16 chars for non-string argument
byte* currentBuffer = dataBuffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3168,7 +3168,7 @@ private static byte[] CreateManifestAndDescriptors(Type eventSourceType, string

if ((flags & EventManifestOptions.Strict) != 0 && (manifest.Errors.Count > 0 || exception != null))
{
string msg = String.Empty;
string msg = string.Empty;
if (manifest.Errors.Count > 0)
{
bool firstError = true;
Expand Down Expand Up @@ -3550,7 +3550,7 @@ internal void ReportOutOfBandMessage(string msg, bool flush)
{
#if (!ES_BUILD_PCL && !ES_BUILD_PN)
// send message to debugger without delay
System.Diagnostics.Debugger.Log(0, null, String.Format("EventSource Error: {0}{1}", msg, Environment.NewLine));
System.Diagnostics.Debugger.Log(0, null, string.Format("EventSource Error: {0}{1}", msg, Environment.NewLine));
#endif

// Send it to all listeners.
Expand Down Expand Up @@ -4231,7 +4231,7 @@ public class EventCommandEventArgs : EventArgs
/// <summary>
/// Gets the arguments for the callback.
/// </summary>
public IDictionary<String, String> Arguments { get; internal set; }
public IDictionary<string, string> Arguments { get; internal set; }

/// <summary>
/// Enables the event that has the specified identifier.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ public static string GetResourceString(string key, params object[] args)
if (fmt != null)
return string.Format(fmt, args);

string sargs = String.Empty;
string sargs = string.Empty;
foreach(var arg in args)
{
if (sargs != String.Empty)
if (sargs != string.Empty)
sargs += ", ";
sargs += arg.ToString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public bool TryGetValue(string key, out object value)
position++;
}

value = default(object);
value = default;
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public struct Scalar
private PropertyValue(object value)
{
_reference = value;
_scalar = default(Scalar);
_scalar = default;
_scalarLength = 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,11 @@ private unsafe void WriteMultiMergeInner(
var scratch = stackalloc byte[eventTypes.scratchSize];
var descriptors = stackalloc EventData[eventTypes.dataCount + 3];
for(int i = 0; i < eventTypes.dataCount + 3; i++)
descriptors[i] = default(EventData);
descriptors[i] = default;

var pins = stackalloc GCHandle[pinCount];
for (int i = 0; i < pinCount; i++)
pins[i] = default(GCHandle);
pins[i] = default;

fixed (byte*
pMetadata0 = this.providerMetadata,
Expand Down Expand Up @@ -563,7 +563,7 @@ internal unsafe void WriteMultiMerge(
var descriptorsLength = eventTypes.dataCount + eventTypes.typeInfos.Length * 2 + 3;
var descriptors = stackalloc EventData[descriptorsLength];
for(int i = 0; i < descriptorsLength; i++)
descriptors[i] = default(EventData);
descriptors[i] = default;

fixed (byte*
pMetadata0 = this.providerMetadata,
Expand Down Expand Up @@ -632,11 +632,11 @@ private unsafe void WriteImpl(
var scratch = stackalloc byte[eventTypes.scratchSize];
var descriptors = stackalloc EventData[eventTypes.dataCount + 3];
for(int i=0; i<eventTypes.dataCount + 3; i++)
descriptors[i] = default(EventData);
descriptors[i] = default;

var pins = stackalloc GCHandle[pinCount];
for (int i = 0; i < pinCount; i++)
pins[i] = default(GCHandle);
pins[i] = default;

fixed (byte*
pMetadata0 = this.providerMetadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ internal static void CheckAddResult(long ticks, DateTime minValue, DateTime maxV
if (ticks < minValue.Ticks || ticks > maxValue.Ticks)
{
throw new ArgumentException(
String.Format(CultureInfo.InvariantCulture, SR.Format(SR.Argument_ResultCalendarRange,
string.Format(CultureInfo.InvariantCulture, SR.Format(SR.Argument_ResultCalendarRange,
minValue, maxValue)));
}
}
Expand Down Expand Up @@ -818,7 +818,7 @@ internal static long TimeToTicks(int hour, int minute, int second, int milliseco
{
throw new ArgumentOutOfRangeException(
nameof(millisecond),
String.Format(
string.Format(
CultureInfo.InvariantCulture,
SR.Format(SR.ArgumentOutOfRange_Range, 0, MillisPerSecond - 1)));
}
Expand Down
Loading