initonly (C++/CLI)
initonly is a context-sensitive keyword that indicates that variable assignment can occur only as part of the declaration or in a static constructor in the same class.
The following example shows how to use initionly
:
// mcpp_initonly.cpp
// compile with: /clr /c
ref struct Y1 {
initonly
static int staticConst1;
initonly
static int staticConst2 = 0;
static Y1() {
staticConst1 = 0;
}
};
See also
Зворотний зв’язок
https://aka.ms/ContentUserFeedback.
Очікується незабаром: протягом 2024 року ми будемо припиняти використання механізму реєстрації проблем у GitHub для зворотного зв’язку щодо вмісту й замінювати його новою системою зворотного зв’язку. Докладніше:Надіслати й переглянути відгук про