Visual C++ .NET/Development/ResourceReader — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 15:31, 26 мая 2010
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"));
}