请教高手 点指 把下面这段代码 改写成 C#
Public Shared Sub ChangeDataGridViewColumnName(ByVal cols As DataGridViewColumnCollection, _
ByVal ColNames As Object, ByVal NewColNames As Object)
For Each p As System.Reflection.PropertyInfo In ColNames.GetType.GetProperties
Try
Dim Value As String = p.GetValue(ColNames, Nothing)
If cols.Contains(Value) Then
cols(Value).Name = getPropertyInfo(NewColNames, p.Name).GetValue(NewColNames, Nothing)
End If
Catch ex As Exception End Try
Next
End Sub其中cols(Value).Name 这一段该如何改写 c#
Public Shared Sub ChangeDataGridViewColumnName(ByVal cols As DataGridViewColumnCollection, _
ByVal ColNames As Object, ByVal NewColNames As Object)
For Each p As System.Reflection.PropertyInfo In ColNames.GetType.GetProperties
Try
Dim Value As String = p.GetValue(ColNames, Nothing)
If cols.Contains(Value) Then
cols(Value).Name = getPropertyInfo(NewColNames, p.Name).GetValue(NewColNames, Nothing)
End If
Catch ex As Exception End Try
Next
End Sub其中cols(Value).Name 这一段该如何改写 c#
解决方案 »
- VS08打開未知版本的某winform項目,發現其文件包含的子文件問題
- 这两种赋值方式一样吗?
- ASP.NET讀取域用戶信息,比如:郵箱,電話,權限等
- 在C#中查找窗体内所有的文本框,并且让一部分的文本框只能输入数字?
- Sql server2005返回Nvarchar类型值只能得到第一个字符!
- C#正则表达式提取数据
- 在网站运行中,将某CS文件更新了,请问如何使其应用起来
- 怎样在vc#开发的项目菜单中插入图标?
- 请问高手:
- 一个单独的CS 文件如何在Visual .net中编译
- 一个算法题: 1、1、2、3、5、8、13、21、34 求第30位数是多少
- 关于调用C写的dll问题,有点难度,急求解答,分不够再加。
var value=f.GetValue(ColNames, Nothing);
if(cols.Contains(value))
{
cols[value].Name = getPropertyInfo(NewColNames, p.Name).GetValue(NewColNames, Nothing)
}
})