This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Student | |
{ | |
public string Name { get; set; } | |
public enum Gender | |
{ | |
Male, Female | |
} | |
public int Age { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Newtonsoft.Json; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Threading; | |
namespace TestConsoleApp | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Management; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace TestCSharpApp | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Win32; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Windows.Forms; | |
namespace TestCSharpApp | |
{ | |
public partial class Form1 : Form | |
{ | |
public Form1() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Collections.Generic; | |
public class Test | |
{ | |
static ExecutionContext _ec; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<Tuple<string, string, string>> rBinFiles = new List<Tuple<string, string, string>>(); | |
private void Button1_Click(object sender, EventArgs e) | |
{ | |
var recycleBin = @"C:\$Recycle.Bin"; | |
DirectoryInfo rBinInfo = new DirectoryInfo(recycleBin); | |
GetBinFileNames(); | |
foreach (List<Tuple<string, string, string>> t in GetBinFileNames()) | |
{ | |
t.ForEach((Tuple<string, string, string> name) => | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
} | |
private static readonly string FilePath = Path.Combine(Application.StartupPath, "txt1.txt"); | |
private static readonly string ErrorLog = FilePath.Replace(Path.GetFileName(FilePath), "errorlog.log"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
} | |
public static readonly string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "mytext.txt"); | |
private void Button1_Click(object sender, EventArgs e) | |
{ | |
using (FileStream reader = File.OpenRead(path)) |
NewerOlder