Материал из .Net Framework эксперт
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
ResourceReader, ResourceManager
#include "stdafx.h"
using namespace System;
using namespace System::Collections;
using namespace System::Reflection;
using namespace System::Resources;
int main(array<System::String ^> ^args)
{
ResourceReader ^rreader = gcnew ResourceReader("F.resources");
IDictionaryEnumerator ^denum = rreader->GetEnumerator();
while (denum->MoveNext())
{
Console::WriteLine("{0} = {1}", denum->Key, denum->Value);
}
rreader->Close();
ResourceManager ^rmgr;
rmgr = ResourceManager::CreateFileBasedResourceManager("F", "",nullptr);
Console::WriteLine(rmgr->GetString("Fruit1"));
Console::WriteLine(rmgr->GetString("Fruit2"));
Console::WriteLine(rmgr->GetString("Fruit3"));
Console::WriteLine(rmgr->GetString("Fruit4"));
Assembly ^assembly = Assembly::GetExecutingAssembly();
rmgr = gcnew ResourceManager("Fruit", assembly);
Console::WriteLine(rmgr->GetObject("Fruit1"));
Console::WriteLine(rmgr->GetObject("Fruit2"));
Console::WriteLine(rmgr->GetObject("Fruit3"));
Console::WriteLine(rmgr->GetObject("Fruit4"));
}