Skip to content

[Code Style] PrefixInfo data in cs file. #1635

@Ted-Jin-Lab

Description

@Ted-Jin-Lab

Almost all data about the units is in json file in the path Common

But the data about the prefix is in cs file.

public static readonly IReadOnlyDictionary<Prefix, PrefixInfo> Entries = new[]
{
// SI prefixes
new PrefixInfo(Prefix.Yocto, "1e-24d", "y",(Chinese, "夭")),
new PrefixInfo(Prefix.Zepto, "1e-21d", "z",(Chinese, "仄")),
new PrefixInfo(Prefix.Atto, "1e-18d", "a", (Russian, "а"),(Chinese, "阿")),
new PrefixInfo(Prefix.Femto, "1e-15d", "f", (Russian, "ф"),(Chinese, "飞")),
new PrefixInfo(Prefix.Pico, "1e-12d", "p", (Russian, "п"),(Chinese, "皮")),
new PrefixInfo(Prefix.Nano, "1e-9d", "n", (Russian, "н"),(Chinese, "纳")),
new PrefixInfo(Prefix.Micro, "1e-6d", "µ", (Russian, "мк"),(Chinese, "微")),
new PrefixInfo(Prefix.Milli, "1e-3d", "m", (Russian, "м"),(Chinese, "毫")),
new PrefixInfo(Prefix.Centi, "1e-2d", "c", (Russian, "с"),(Chinese, "厘")),
new PrefixInfo(Prefix.Deci, "1e-1d", "d", (Russian, "д"),(Chinese, "分")),
new PrefixInfo(Prefix.Deca, "1e1d", "da", (Russian, "да"),(Chinese, "十")),
new PrefixInfo(Prefix.Hecto, "1e2d", "h", (Russian, "г"),(Chinese, "百")),
new PrefixInfo(Prefix.Kilo, "1e3d", "k", (Russian, "к"),(Chinese, "千")),
new PrefixInfo(Prefix.Mega, "1e6d", "M", (Russian, "М"),(Chinese, "兆")),
new PrefixInfo(Prefix.Giga, "1e9d", "G", (Russian, "Г"),(Chinese, "吉")),
new PrefixInfo(Prefix.Tera, "1e12d", "T", (Russian, "Т"),(Chinese, "太")),
new PrefixInfo(Prefix.Peta, "1e15d", "P", (Russian, "П"),(Chinese, "拍")),
new PrefixInfo(Prefix.Exa, "1e18d", "E", (Russian, "Э"),(Chinese, "艾")),
new PrefixInfo(Prefix.Zetta, "1e21d", "Z",(Chinese, "泽")),
new PrefixInfo(Prefix.Yotta, "1e24d", "Y",(Chinese, "尧")),
// Binary prefixes
new PrefixInfo(Prefix.Kibi, "1024d", "Ki"),
new PrefixInfo(Prefix.Mebi, "(1024d * 1024)", "Mi"),
new PrefixInfo(Prefix.Gibi, "(1024d * 1024 * 1024)", "Gi"),
new PrefixInfo(Prefix.Tebi, "(1024d * 1024 * 1024 * 1024)", "Ti"),
new PrefixInfo(Prefix.Pebi, "(1024d * 1024 * 1024 * 1024 * 1024)", "Pi"),
new PrefixInfo(Prefix.Exbi, "(1024d * 1024 * 1024 * 1024 * 1024 * 1024)", "Ei")
}.ToDictionary(prefixInfo => prefixInfo.Prefix);

Is that possible to move them to Json, too? Just for Code Style.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions