Skip to content

Instantly share code, notes, and snippets.

View nelopauselli's full-sized avatar

Nelo Pauselli nelopauselli

View GitHub Profile
@nelopauselli
nelopauselli / ProductFilter.cs
Created July 16, 2012 13:44
Implementando SOLID - OCP
using System.Collections.Generic;
using System.Linq;
namespace OCP.Filter.Model
{
class ProductFilter
{
public IEnumerable<Product> ByCriteria(IList<Product> products, ICriteria criteria)
{
foreach (var product in products)
@nelopauselli
nelopauselli / MyFileReader.cs
Created July 13, 2012 10:47
Clase responsable de la lectura de archivos
internal class MyFileReader
{
public void ReadFile(string fileName, Action<string, string, string, string> callback)
{
using (var fs = new FileStream(fileName, FileMode.Open))
{
var reader = XmlReader.Create(fs);
while (reader.Read())
{
if (reader.Name != "product") continue;
@nelopauselli
nelopauselli / Form1.cs
Created July 13, 2012 10:36
Clase responsable del manejo del formulario
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnBrowse_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "XML Document (*.xml)|*.xml|All Files (*.*)|*.*";