xiaobin_hlj80

https://blog.csdn.net/xiaobin_HLJ80 http://blog.chinaunix.net/uid/31552151.html

导航

Try Value

Get Value by Key

  • GetValueOrDefault

.net core

  • TryGetValue

fx

GetValueOrDefault

Dictionary<string, string> m_kbd = new Dictionary<string, string>();
result += m_kbd.GetValueOrDefault(kbd.Key);

TryGetValue

Dictionary<string, string> m_kbd = new Dictionary<string, string>();
result += m_kbd.TryGetValue(kbd.Key, out var value)? value : null;

Get an integer from a string

  • TryParse

TryParse

string itostr(string val)
{
    string result = "";
    int iVal = 0;

    if (Int32.TryParse(val, out iVal))
    {
        val = "_" + iVal;
    }

    result = val;

    return result;
}

Ref

posted on 2025-12-06 14:19  xiaobin80  阅读(245)  评论(0)    收藏  举报