# C++ to C# Porting Rules Rule 1 const ACHAR* → string Rule 2 output parameters C++: int& value C#: ref int value Rule 3 pointer T* → reference Rule 4 array ACHAR buffer[1024] C#: Span hoặc string builder Rule 5 container AArray → List Rule 6 memory ownership C++ có delete C# dùng GC Rule 7 Chat Message Handling C++: g_pGame->GetGameRun()->AddChatMessage(str, p->channel, p->srcroleid, NULL, 0, p->emotion,pItem ? pItem->Clone() : NULL, strMsgOrigion); C#: EC_Game.GetGameRun().AddChatMessage(str, p.Channel, p.Srcroleid,null, 0, p.Emotion, null, strMsgOrigion); Rule 8 Chat Bubble on Top Player C++: pPlayer.SetLastSaidWords(strTemp, p.Emotion); C#: EventBus.PublishChannel(p.Srcroleid, new EventChatMessageOnTopPlayer(p.Srcroleid, strTemp));