Skip to content

Instantly share code, notes, and snippets.

View Sheepings's full-sized avatar
🎯
Focusing

Sheepings Sheepings

🎯
Focusing
  • UK
View GitHub Profile
@Sheepings
Sheepings / Binding_INotifyPropertyChanged.xaml.cs
Created March 22, 2020 20:03
INotifyPropertyChanged With Bindings
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace WPFTestApp
{
public partial class Window1 : Window
{
@Sheepings
Sheepings / RemoveItemFromArray.cs
Created July 15, 2020 12:52
A snipped for removing items from an array
public class Student
{
public string Name { get; set; }
public enum Gender
{
Male, Female
}
public int Age { get; set; }
@Sheepings
Sheepings / Program.cs
Created July 17, 2020 20:09
How to work with arrays with null values
string[] lString = new string[] { "All", "Apples", null, null };
/* Using an enumerator to step through the array of strings where the values are not null */
IEnumerator enumerator = (from lValue in lString where lValue != null select lValue).ToArray().GetEnumerator();
while (enumerator.MoveNext())
{
Console.WriteLine(enumerator.Current);
}
/* For each string in the array, select where the value is not null, and do something with the value */