xtd 0.2.0
action2.cpp

This example simplifies this code by instantiating the xtd::action delegate instead of explicitly defining a new delegate and assigning a named method to it.

#include <xtd/action>
#include <xtd/console>
#include <xtd/environment>
#include <xtd/forms/message_box>
using namespace xtd;
using namespace xtd::forms;
using display_message = action<const string&>;
void show_windows_message(const string& message) {
}
void write_line(const string& message) {
}
auto main() -> int {
auto message_target = display_message {};
message_target = show_windows_message;
else
message_target = write_line;
message_target("Hello, World!");
}
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
static xtd::argument_collection get_command_line_args()
Returns a string array containing the command-line arguments for the current process.
static dialog_result show(const iwin32_window &owner)
Displays a message box in front of the specified window.
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
delegate< void(arguments_t...)> action
Represents a xtd::delegate that has variable parameters and does not return a value.
Definition action.hpp:20
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Implements a Windows message.
Definition message.hpp:33