Если Ваше использование PHP и MySQL, можно использовать mysql_insert_id () функция, которая скажет Вам идентификатор объекта Вы Просто instered.
, Но без Вашего Языка и DBMS я просто стреляю в темноте здесь.
VB C#
UBound() = yourArray.GetUpperBound(0) or yourArray.Length for one-dimesional arrays
LBound() = yourArray.GetLowerBound(0)
IsNothing() = Object.ReferenceEquals(obj,null)
Chr() = Convert.ToChar()
Len() = "string".Length
UCase() = "string".ToUpper()
LCase() = "string".ToLower()
Left() = "string".Substring(0, length)
Right() = "string".Substring("string".Length - desiredLength)
RTrim() = "string".TrimEnd()
LTrim() = "string".TrimStart()
Trim() = "string".Trim()
Mid() = "string".Substring(start, length)
Replace() = "string".Replace()
Split() = "string".Split()
Join() = String.Join()
MsgBox() = MessageBox.Show()
IIF() = (boolean_condition ? "true" : "false")
Notes
yourArray.GetUpperBound (0)
vs yourArray.Length
: если массив имеет нулевую длину, GetUpperBound вернет -1, а Length вернет 0. UBound ()
в VB.NET вернет -1 для нулевой длины массивы. Mid ("asdf", 2,2)
соответствует "asdf" .SubString (1,2)
. ?
не является точным эквивалентом IIf
, потому что IIf
всегда оценивает оба аргумента, а ?
оценивает только тот, который ему нужен. Это может иметь значение, если есть побочные эффекты оценки ~ дрожь! Len ()
, UCase ()
, ] LCase ()
, Right ()
, RTrim ()
и Trim ()
, будут обрабатывать аргумент Nothing
( Null
в C #) как эквивалент строки нулевой длины. Выполнение строковых методов для Nothing
, конечно же, вызовет исключение. Nothing
классическому VB Mid ()
и ] Replace ()
функции. Вместо того, чтобы генерировать исключение, они вернут Nothing
. Если вы посмотрите на MSDN, вы увидите, что в большинстве случаев есть примеры кода для обоих языков.
Another one...
VB - IsDBNull(value)
C# - yourdatarow.IsNull("columnName")
I believe some of these like Mid()
are still available in the .NET Framework in the Microsoft.VisualBasic namespace which you can still reference from C# code.
First of all, most of those are NOT operators. They are functions, and the functions are only included in VB.Net for compatibility reasons. That means you shouldn't use them in VB.net either, and instead use the equivalents provided by the new API.
arrayVar.Length
Is Nothing
in VB.Net and == null
in C#Convert.ToChar()
or (char)someVar
stringVar.Length
use this in VB toostringVar.ToUpper()
use this in VB toostringVar.ToLower()
use this in VB toostringVar.Substring(0, n)
use this in VB toostringVar.Substring(stringVar.Length - n)
use this in VB toostringVar.TrimEnd()
use this in VB toostringVar.TrimStart()
use this in VB toostringVar.Trim()
use this in VB toostringVar.Substring(n, m)
use this in VB toostringVar.Replace()
use this in VB toostringVar.Split()
use this in VB tooString.Join()
use this in VB tooMessageBox.Show()
(condition) ? truepart : falsepart
- note that there are some differences, because "?" is an operator and not a function IIf (test, trueval, falseval)
>> (тест? Trueval: falseval);
IsNothing (obj)
>> (obj == null);
UCase (str)
>> str.ToUpper ();
LCase (str)
>> str.ToLower ();
Большинство из них будут методами экземпляра строкового объекта, которые возвращают измененную строку.
MsgBox vs. MessageBox.Show(..)
IIF vs. (expression?returnValueIfTrue:returnValueElse)
All these functions are member methods of the Microsoft.VisualBasic.Information
class, in the Microsoft.VisualBasic
assembly, so you can use them directly. However, most of them have C# equivalents, or non language specific equivalents in core .NET framework classes :
Array.GetUpperBound
Array.GetLowerBound
== null
(char)intValue
(cast)String.Length
String.ToUpper
String.ToLower
String.Substring
(with different arguments)String.TrimEnd
String.TrimStart
String.Trim
String.Replace
String.Split
String.Join
MessageBox.Show
condition ? valueIfTrue : valueIfFalse
(conditional operator)Links
UBound() "array".Length
LBound()
IsNothing(): "object" == null
Chr() (char)"N"
Len() "string".Length
UCase() "string".ToUpper()
LCase() "string".ToLower()
Left() "string".Substring(from, to)
Right() "string".Substring(from, to)
RTrim() "string".TrimEnd()
LTrim() "string".TrimStart()
Trim() "string".Trim()
Mid() "string".Substring(from, to)
Replace() "string".Replace()
Split() "string".Split()
Join() String.Join()
MsgBox() MessageBox.Show()
IIF() validate ? iftrue : iffalse;
Вы найдете преобразование для многих из этих функций на этой странице википедии .