Skip to content

Instantly share code, notes, and snippets.

@jindeveloper
jindeveloper / SimpleHttpClient.cs
Created June 9, 2019 13:09 — forked from bryanbarnard/SimpleHttpClient.cs
Simple C# .NET 4.5 HTTPClient Request Using Basic Auth and Proxy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
class Program
{
static void Main(string[] args)
{
string address = "https://www.google.com/webhp?hl=fil&sa=X&ved=0ahUKEwiC9fW2rtziAhWGF4gKHeYaC6kQPAgH";
Uri uriGoogle = new Uri(address);
PrintInfo(uriGoogle);
<# start of block comment
Why powershell?
* it object oriented
* rich script environment
* bulk operations
* interactive shell
* task automation
* use of consistent, repetable task
@jindeveloper
jindeveloper / Program.cs
Created June 29, 2019 11:10
C# struct sample
using System;
namespace ConsoleApp1
{
public interface IEmployee
{
void DefaultRecords();
}
public enum Benefit
@jindeveloper
jindeveloper / unittestconsole.cs
Created November 10, 2019 15:24 — forked from asierba/unittestconsole.cs
How to mock console in unit tests
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("What's your name?");
var name = Console.ReadLine();
Console.WriteLine(string.Format("Hello {0}!!", name));
}
[Test]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ExploreDictionaryListComparison
{
public enum ServerConnection
{
@jindeveloper
jindeveloper / planet.json
Created June 13, 2020 12:59 — forked from IDdesigner/planet.json
JSON of the planets
[
{
"planet": "Mercury",
"moons": 0,
"diameter": 4879,
"distanceFromSun": 57.9
},
{
"planet": "Venus",
"moons": 0,
[Fact]
public void Test_GetAll_BuiltIn_Attributes()
{
var assembly = Assembly.Load(assemblyFullName);
var attributes = assembly
.DefinedTypes
.Where(type =>
type
.IsSubclassOf(typeof(Attribute)));
using System;
using System.Diagnostics;
namespace CSharp_Attributes_Walkthrough.My_Custom_Attributes
{
[Serializable]
public class Product
{
public string Name { get; set; }
public string Code { get; set; }
[Fact]
public void Test_Read_Attributes()
{
//get the Product-class
var type = typeof(Product);
//Get the attributes of the Product-class and we are expecting the [Serializable]
var attribute = (SerializableAttribute)type.
GetCustomAttributes(typeof(SerializableAttribute), false).FirstOrDefault();