vc++.net 基本上保留了vc++的东西,但是在细节上也有了些差别,和c#的差别是非常大。下面是摸索的一个小小例子的一段代码。
从代码可以看出,声明所有引用类型的对象的时候,要有一个^
比如:System::String^ strA;
private
: System::Void button1_Click(System::Object
^
sender, System::EventArgs
^
e)
...
{
//System::String^ a;
//a="liujincai is a good person!";
//MessageBox::Show(a,"haoren",System::Windows::Forms::MessageBoxButtons::OK);
System::Collections::SortedList^ b;
CrcDbConnection::CrcDbConnection^ d=gcnew CrcDbConnection::CrcDbConnection();
d->ConnDatabase();
b=d->GetCodeSortList();
System::Text::StringBuilder^ sb=gcnew System::Text::StringBuilder();
System::Int32 i=0;
for(System::Int32 j=0;j<b->Count;j++)
...{
sb->Append(System::Environment::NewLine);
sb->Append(b->GetByIndex(j));
}
MessageBox::Show(sb->ToString());
}