Introduction
This page is more a reminder of formatting and general information that I need to remember rather than looking at Google.
Home | Applications | Documentation | Transport | Personal |
Introduction
This page is more a reminder of formatting and general information that I need to remember rather than looking at Google.
Basic Object
class Person
{
public string title { get; set; }
public string firstname { get; set; }
public string surname { get; set; }
public string concatName()
{
return (title + " " + firstname + " " + surname).Trim().ToString();
}
}
Define and allocate values and run method
Person person = new Person() { title = "Mr", firstname = "Dave",
surname = "Skin" };
Console.WriteLine("My full name is " + person.concatName());
Collections of objects : (Lists)
List<Person> people = new List<Person>();
people.Add(new Person { title = "Mr", firstName = "Dave",
surname = "Skin" });
Invoke
Invoking refers to calling a method. In winforms Control. Invoke is used to call a method on the UI thread — without it you can cause an exception by updating the UI from another thread. And so if InvokeRequires returns true it means that you are not running in the UI thread and should use Control.