我想使用 Regex.Replace 方法。我将在很长的字符串中搜索“new long?((long)”表达式并进行以下更改。
前:
OracleParameter[] array = new OracleParameter[]
{
new OracleParameter("p_op_adi", OracleDbType.Varchar2, p_op_adi, ParameterDirection.Input),
new OracleParameter("p_tip_no", OracleDbType.Int64, p_tip_no, ParameterDirection.Input),
new OracleParameter("p_islem", OracleDbType.Varchar2, p_islem, ParameterDirection.Input),
new OracleParameter("p_raise", OracleDbType.Varchar2, p_raise, ParameterDirection.Input),
new OracleParameter("p_durum", OracleDbType.Int64, null, ParameterDirection.Output),
new OracleParameter("p_mesaj", OracleDbType.Varchar2, 4000, null, ParameterDirection.Output)
};
sMan.ExecuteSP("FRM_USER.user_yetki_kontrol_islem", array);
p_durum = ((array[4].Value != System.DBNull.Value) ? new long?((long)array[4].Value) : null);
p_mesaj = array[5].Value.ToString();
正则表达式之后:
OracleParameter[] array = new OracleParameter[]
{
new OracleParameter("p_op_adi", OracleDbType.Varchar2, p_op_adi, ParameterDirection.Input),
new OracleParameter("p_tip_no", OracleDbType.Int64, p_tip_no, ParameterDirection.Input),
new OracleParameter("p_islem", OracleDbType.Varchar2, p_islem, ParameterDirection.Input),
new OracleParameter("p_raise", OracleDbType.Varchar2, p_raise, ParameterDirection.Input),
new OracleParameter("p_durum", OracleDbType.Int64, null, ParameterDirection.Output),
new OracleParameter("p_mesaj", OracleDbType.Varchar2, 4000, null, ParameterDirection.Output)
};
sMan.ExecuteSP("FRM_USER.user_yetki_kontrol_islem", array);
p_durum = abcde(array[4].Value);
p_mesaj = array[5].Value.ToString();
请注意,我必须捕获数组索引号 4。