Skip to content

Instantly share code, notes, and snippets.

View MarcosMeli's full-sized avatar
🏠
Working from home

Marcos Meli MarcosMeli

🏠
Working from home
View GitHub Profile
public static T ItemGetOrSet<T>(this HttpRequestBase request, string key, Func<T> calculator) where T: class
{
if (request.RequestContext.HttpContext.Items.Contains(key))
return (T) request.RequestContext.HttpContext.Items[key];
var val = calculator();
request.RequestContext.HttpContext.Items[key] = val;
return val;
}
using System.Collections.Generic;
namespace DotCheck.Models
{
public class QuestionFactory
{
public static List<ExamQuestion> FromConfig(ExamConfig config)
{
var res = new List<ExamQuestion>();
var currentCategory = "";
@MarcosMeli
MarcosMeli / ProcessContext.cs
Last active August 29, 2015 14:24
FileHelpers 4.0 API brainstorming www.filehelpers.net
var engine = new FileHelperEngine<RecordClass>():
var context = engine.CreateContext(): // will return a ProcessContext<RecordClass>
// e will be of type FieldErrorEventHandler<T>
context.Callbacks.OnFieldError = e => {
// Fields of e
e.Field
e.Record
e.RecordLine