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
Last active November 29, 2017 10:39
Using C# relational and equality operators
namespace implement_program_flow
{
class Program
{
static void Main(string[] args)
{
//C# relational and equality operators
const int mySalary = 1000;
const int anonSalary = 1500;
@luisdeol
luisdeol / Program.cs
Last active November 29, 2017 10:39
Using Logical XOR and Conditional AND and OR operators
namespace implement_program_flow
{
class Program
{
static void Main(string[] args)
{
var falseValue = false;
var trueValue = true;
Console.WriteLine(falseValue || trueValue);
@luisdeol
luisdeol / Program.cs
Created November 29, 2017 10:38
Using the if and statement
namespace implement_program_flow
{
class Program
{
static void Main(string[] args)
{
var coffee = true;
var isDeadlineClose = false;
if (coffee)
{
@luisdeol
luisdeol / Program.cs
Created November 29, 2017 10:42
Using the Conditional and Null-coalescing operator
namespace implement_program_flow
{
class Program
{
static void Main(string[] args)
{
// Null-coalescing operator
var words = new[] { "Luis", "Felipe", "Jorge", "Joel", "Helora" };
var richardName = words.SingleOrDefault(w => w == "Richard") ?? "Default"; // FirstOrDefault returns null if there is no "Richard"
@luisdeol
luisdeol / Program.cs
Created November 29, 2017 10:44
Using the Switch statement
namespace implement_program_flow
{
class Program
{
static void Main(string[] args)
{
// The Switch Statemenet
var rankingPosition = 1;
switch (rankingPosition)
@luisdeol
luisdeol / EnumDropDownListForExemplo.cs
Last active December 11, 2017 23:35
Exemplo DevMEdia
Home.cshtml
@using WebApplication3.Controllers
@model WebApplication3.Controllers.Conta
@{
ViewBag.Title = "Novidade do ASP.NET MVC 5";
string nomeDiaSemana = Model.DiaDaSemana.GetDescription();
}
@luisdeol
luisdeol / ExemploXmlLista.cs
Last active December 23, 2017 01:31
Exemplo criado para mostrar o uso de Lista de Registros a serem salvos em um único arquivo
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
namespace XmlExemploDevMedia
{
class Program
{
@luisdeol
luisdeol / Program.cs
Created January 7, 2018 22:32
Understanding Delegates
using System;
namespace create_implement_events_callbacks
{
class Program
{
public delegate int Calculate(int x, int y);
public static int Add(int x, int y)
{
@luisdeol
luisdeol / Program.cs
Created January 7, 2018 22:33
Multicasting delegate
using System;
namespace create_implement_events_callbacks
{
class Program
{
public delegate void Calculate(int x, int y);
public static void Add(int x, int y)
{
@luisdeol
luisdeol / Program.cs
Last active January 11, 2018 00:07
Using Lambda Expressions
using System;
namespace create_implement_events_callbacks
{
class Program
{
public delegate int Calculate(int x, int y);
public delegate void ShowMessage(string message);
static void Main(string[] args)