dataGridView1[0,1].Value = "Какое то новое значение".
dataGridView1.DataSource = Grep();
dataGridView1.Refresh();
dataGridView1.Update();
public class User : INotifyPropertyChanged
{
private string _name;
private int _age;
public string Name
{
get => _name;
set { _name = value; OnPropertyChanged(); }
}
public int Age
{
get => _age;
set { _age = value; OnPropertyChanged(); }
}
public User() { }
public User(string name, int age)
{
Name = name;
Age = age;
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
var itemStates = new List<User>()
{
new User("Анимэшник", 0),
new User("Не анимэшник", 18)
};
var bindingList = new BindingList<User>(itemStates);
var source = new BindingSource(bindingList, null);
dataGridView1.DataSource = source;
await Task.Run(async () =>
{
for (int i = 18; i < 30; i++)
{
await Task.Delay(1000);
itemStates.Where(user => user.Name.Equals("Не анимэшник")).FirstOrDefault().Age = i;
}
});
var words = new[] { "Привет", "меня", "зовут", "*", "Мой", "возраст", "таков" };
var variables = new Dictionary<string, string>()
{
{"name", string.Empty},
{"age", string.Empty}
};
var items = words.Select((word, index) => new
{
Item = word,
Index = index,
Group = words.Skip(index)
.Select((wordFind, indexFind) => new
{
Item = wordFind,
Index = indexFind + index
})
.FirstOrDefault(wordFilter => wordFilter.Item.Equals("*"))
}).GroupBy(wordGroup => wordGroup.Group?.Index);
foreach (var item in items)
{
var groupped = string.Join(" ",
item.Select(word => word.Item)
.Where(word => !word.Equals("*")));
var key = variables.Where(keyVariable => keyVariable.Value.Equals(string.Empty))
.Select(keyVariable => keyVariable.Key).FirstOrDefault();
if (key != null && variables.ContainsKey(key))
{
variables[key] = groupped;
}
}
Debug.WriteLine(
string.Join("\n", variables.Select(wordsObject =>
$"key: {wordsObject.Key}, value: {wordsObject.Value}")));
var array = new[] { 55, 2, 9, 99, 12, 13, 23, 32, 5, 11, 1 };
for (var first = 0; first < array.Length; first++)
{
for (var second = first; second < array.Length; second++)
{
if (array[first] % 2 == 1 && array[second] % 2 == 1 && array[first] > array[second])
{
var temp = array[first];
array[first] = array[second];
array[second] = temp;
}
}
}
let objects = {
allButton: {
wrapper: 'menuWrapper',
selector: 'li',
'function': 'querySelectorAll'
},
loveButton : {
wrapper: 'menuWrapper',
selector: '.lovers',
'function': 'querySelector'
},
};
Object.entries(objects).forEach(entry => {
const [key, value] = entry;
const wrapper = document.querySelector(value.wrapper);
value.object = wrapper[value.function](value.selector);
});
var sorted = num0.OrderBy(item => item);
var cookies = await Cef.GetGlobalCookieManager().VisitAllCookiesAsync();
let html = [
{
'type': 'div',
'args': {
'id': 'dialog',
},
'childrens': [
{
'type': 'h1',
'args': {
'textContent': 'Заголовок 1'
}
},
{
'type': 'h2',
'args': {
'textContent': 'Заголовок 2'
}
},
{
'type': 'h5',
'args': {
'textContent': 'Заголовок 5'
}
},
{
'type': 'p',
'args': {
'textContent': 'Параграф'
}
},
]
}
];
html.forEach(parent => {
let parentObject = document.createElement(parent.type);
Object.entries(parent.args).forEach(([key, value]) => {
parentObject[key] = value;
});
parent.childrens.forEach(children => {
let childrenObject = document.createElement(children.type);
Object.entries(children.args).forEach(([key, value]) => {
childrenObject[key] = value;
});
parentObject.appendChild(childrenObject);
});
document.body.appendChild(parentObject);
});
$options = [
[
"condition" => isModerator(),
"execute" => function () {
echo 'isModerator';
}
],
[
"condition" => isSupport(),
"execute" => function () {
echo 'isSupport';
}
],
];
array_walk(array_filter($options, function ($item) {
return $item["condition"];
}), function ($item) {
$item["execute"]();
});
'title' => 'Animal Squad'