Skip to content

Instantly share code, notes, and snippets.

View luisdeol's full-sized avatar
🎯
Focusing

Luis Felipe de Oliveira luisdeol

🎯
Focusing
View GitHub Profile
@luisdeol
luisdeol / Program.cs
Created January 7, 2018 22:58
Raising an event using Action delegate
using System;
namespace create_implement_events_callbacks
{
class Program
{
static void Main(string[] args)
{
var publisher = new Publisher();
@luisdeol
luisdeol / Program.cs
Created January 7, 2018 23:09
Event using event keyword and Event Handler
using System;
namespace create_implement_events_callbacks
{
public class MyArgs : EventArgs
{
public MyArgs(string value)
{
Value = value;
}
@luisdeol
luisdeol / Program.cs
Created January 7, 2018 23:19
Custom event accessors
using System;
namespace create_implement_events_callbacks
{
public class MyArgs : EventArgs
{
public MyArgs(int value)
{
Value = value;
}
@luisdeol
luisdeol / Program.cs
Created January 7, 2018 23:24
Exception Handling when raising events
using System;
using System.Collections.Generic;
using System.Linq;
namespace create_implement_events_callbacks
{
class Program
{
static void Main(string[] args)
{
@luisdeol
luisdeol / Program.cs
Created January 28, 2018 13:44
Code that throws an exception
using System;
namespace implement_exception_handling
{
class Program
{
static void Main(string[] args)
{
var awesomePhrase = "Luis wants some ice cream.";
@luisdeol
luisdeol / Program.cs
Last active January 28, 2018 14:52
Catching multiple exceptions
using System;
using System.Collections.Generic;
namespace implement_exception_handling
{
class Program
{
static void Main(string[] args)
{
var myValues = new List<string> {"Luis wants some ice cream.", null, "1232323212312"};
@luisdeol
luisdeol / Program.cs
Created January 28, 2018 15:04
Re-Throwing Exceptions
using System;
namespace implement_exception_handling
{
class Program
{
static void Main(string[] args)
{
var notSoGreatPhrase = "That is a not-so-great phrase";
@luisdeol
luisdeol / Program.cs
Last active January 28, 2018 15:19
Using the ExceptionDispatchInfo class
using System;
using System.Runtime.ExceptionServices;
namespace implement_exception_handling
{
class Program
{
static void Main(string[] args)
{
var notSoGreatPhrase = "That is a not-so-great phrase";
@luisdeol
luisdeol / Program.cs
Created January 29, 2018 23:40
Creating a Custom Exception
using System;
using System.Runtime.Serialization;
namespace implement_exception_handling
{
class Program
{
static void Main(string[] args)
{
Console.ReadKey();
@luisdeol
luisdeol / App.js
Last active February 6, 2018 00:40
App,js
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import { ModalYesNo } from './components/ModalYesNo';
class App extends Component {
constructor(props) {
super(props);
this.state = {