L
lich
Unregistered / Unconfirmed
GUEST, unregistred user!
这里有一段 Delphi.Net 的代码, 谁能将其翻译成 C# 的
主要的目的是要在静态方法中获得类型信息
Type
TClass1 = class(&Object)
public
class function Test01: Integer;
end;
TClass2 = class(TClass1)
public
procedure Hello;
end;
class function TClass1.Test01: Integer;
begin
MessageBox.Show(Self.ClassInfo.FullName);
Result := 1;
end;
procedure TClass2.Hello;
begin
end;
procedure TWinForm.Button1_Click(sender: System.Object;
e: System.EventArgs);
begin
TClass1.Test01;
//Should show "WinForm.TClass1"
TClass2.Test01;
//Should show "WinForm.TClass2"
end;
主要的目的是要在静态方法中获得类型信息
Type
TClass1 = class(&Object)
public
class function Test01: Integer;
end;
TClass2 = class(TClass1)
public
procedure Hello;
end;
class function TClass1.Test01: Integer;
begin
MessageBox.Show(Self.ClassInfo.FullName);
Result := 1;
end;
procedure TClass2.Hello;
begin
end;
procedure TWinForm.Button1_Click(sender: System.Object;
e: System.EventArgs);
begin
TClass1.Test01;
//Should show "WinForm.TClass1"
TClass2.Test01;
//Should show "WinForm.TClass2"
end;