Skip to content

Instantly share code, notes, and snippets.

View rickyah's full-sized avatar

Ricardo Amores Hernández rickyah

  • Barcelona
  • 02:17 (UTC +02:00)
  • X @rickyah
View GitHub Profile
@rickyah
rickyah / naming_conventions.md
Last active August 29, 2015 13:58
CSharper_naming_conventions

#C# Naming conventions

Why bother?

Using this naming conventions will allow to know if we are dealing with local variables, private fields, or public data just with a glimpse of the code.

In this code: ¿which variables are internal data to the class and which ones are public?

public void MyMethod(int index)
{
@rickyah
rickyah / BenchmarkProperties.cs
Created April 4, 2014 12:44
Benchmark c# accessors vs member variables
using System;
using System.Diagnostics;
public class TestClass
{
public int member;
public int property {get; set;}
}
@rickyah
rickyah / GetCurrentMethodName.cs
Created March 28, 2014 11:02
Get the currently executing method name in .NET/Mono
[MethodImpl(MethodImplOptions.NoInlining)]
public string GetCurrentMethodName()
{
StackTrace st = new StackTrace ();
StackFrame sf = st.GetFrame (1);
MethodBase method = sf.GetMethod();
return method.DeclaringType.FullName + ':' + sf.GetMethod().Name;
}