VB to C# Functions

后端 未结 14 1047
忘了有多久
忘了有多久 2020-12-02 06:51

Which are the equivalent of the following operators from VB.Net to C#?

  • UBound()
  • LBound()
  • IsNothing()
  • <
14条回答
  •  春和景丽
    2020-12-02 07:31

    • UBound() -> if x is an array of string[] for example: x.GetUpperBound();
    • LBound() -> if x is an array of string[] for example: x.GetLowerBound();
    • IsNothing() -> if (x == null)
    • Chr() -> char x = (char)65;
    • Len() -> x.Length();
    • UCase() -> assume x is a string: x.ToUpper();
    • LCase() -> assume x is a string: x.ToLower();
    • Left() -> assume x is a string: x.Substring(0, 10); // first 10 characters
    • Right() -> assume x is a string: x.Substring(x.Length - 10); // last 10 characters
    • RTrim() -> x.TrimEnd();
    • LTrim() -> x.TrimStart();
    • Trim() -> x.Trim();
    • Mid() -> assume x is a string: x.Substring()
    • Replace() -> assume x is a string: x.Replace();
    • Split() -> assume x is a string: x.Split();
    • Join() -> String.Join();
    • MsgBox() -> MessageBox.Show();
    • IIF() -> ternary operator (x == true ? true-value : false-value);

提交回复
热议问题