Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions src/libraries/System.Private.CoreLib/src/System/Modern.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System;

namespace System
{
public static class Modern
{
public static void writeln(object value)
{
Console.WriteLine(value);
}
public static void write(object value)
{
Console.Write(value);
}
public static string? readln()
{
return Console.ReadLine();
}
public static int toint(object value)
{
return Convert.ToInt32(value);
}
public static byte tobyte(object value)
{
return Convert.ToByte(value);
}
public static short toshort(object value)
{
return Convert.ToInt16(value);
}
public static long tolong(object value)
{
return Convert.ToInt64(value);
}
public static float tofloat(object value)
{
return Convert.ToSingle(value);
}
public static double todouble(object value)
{
return Convert.ToDouble(value);
}
public static bool tobool(object value)
{
return Convert.ToBoolean(value);
}
public static char tochar(object value)
{
return Convert.ToChar(value);
}
public static decimal todecimal(object value)
{
return Convert.ToDecimal(value);
}
public static DateTime todatetime(object value)
{
return Convert.ToDateTime(value);
}
public static DateOnly todate(DateTime value)
{
return DateOnly.FromDateTime(value);
}
public static TimeOnly totime(DateTime value)
{
return TimeOnly.FromDateTime(value);
}
public static string tostring(object value)
{
return value.ToString() ?? string.Empty;
}
}
}
Loading