This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Framework.Jobs.Arguments | |
{ | |
using System; | |
using System.Linq.Expressions; | |
public static class StaticReflection | |
{ | |
public static string GetMemberName<T>( | |
this T instance, | |
Expression<Func<T, object>> expression) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @SearchStr nvarchar(100) | |
SET @SearchStr = '1102449' | |
-- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved. | |
-- Purpose: To search all columns of all tables for a given search string | |
-- Written by: Narayana Vyas Kondreddi | |
-- Site: http://vyaskn.tripod.com | |
-- Updated and tested by Tim Gaunt | |
-- http://www.thesitedoctor.co.uk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @TableName VARCHAR(MAX) = 'NewsItem' | |
DECLARE @TableSchema VARCHAR(MAX) = 'Markets' | |
DECLARE @result varchar(max) = '' | |
SET @result = @result + 'using System;' + CHAR(13) + CHAR(13) | |
IF (@TableSchema IS NOT NULL) | |
BEGIN | |
SET @result = @result + 'namespace ' + @TableSchema + CHAR(13) + '{' + CHAR(13) | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Interview Questions</title> | |
<link rel="stylesheet" type="text/css" href="style.css" /> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Need to go direct to the registry as the EventLog.CreateEventSource | |
// method cycles through all logs, including the Security log, to | |
// verify that the source does not exist and is unique | |
try | |
{ | |
var logKeyName = String.Format(CultureInfo.InvariantCulture, @"SYSTEM\CurrentControlSet\Services\EventLog\{0}", log); | |
var sourceKeyName = String.Format(CultureInfo.InvariantCulture, @"SYSTEM\CurrentControlSet\Services\EventLog\{0}\{1}", log, source); | |
using (Registry.LocalMachine.OpenSubKey(logKeyName, RegistryKeyPermissionCheck.ReadWriteSubTree) ?? | |
Registry.LocalMachine.CreateSubKey(logKeyName, RegistryKeyPermissionCheck.ReadWriteSubTree)) | |
using (var sourceKey = Registry.LocalMachine.OpenSubKey(sourceKeyName, RegistryKeyPermissionCheck.ReadWriteSubTree) ?? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class QueryableExtensions | |
{ | |
public static ProjectionExpression<TSource> Project<TSource>(this IQueryable<TSource> source) | |
{ | |
return new ProjectionExpression<TSource>(source); | |
} | |
} | |
public class ProjectionExpression<TSource> | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq.Expressions; | |
class Test | |
{ | |
// This is the method you want, I think | |
static Expression<Func<TInput,object>> AddBox<TInput, TOutput> | |
(Expression<Func<TInput, TOutput>> expression) | |
{ | |
// Add the boxing operation, but get a weakly typed expression |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PowerShell script that recursively deletes all 'bin' and 'obj' (or any other specified) folders inside current folder | |
$CurrentPath = (Get-Location -PSProvider FileSystem).ProviderPath | |
# recursively get all folders matching given includes, except ignored folders | |
$FoldersToRemove = Get-ChildItem .\ -include bin,obj -Recurse | where {$_ -notmatch '_tools' -and $_ -notmatch '_build'} | foreach {$_.fullname} | |
# recursively get all folders matching given includes | |
$AllFolders = Get-ChildItem .\ -include bin,obj -Recurse | foreach {$_.fullname} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace System | |
{ | |
using System.Collections.Generic; | |
/// <summary> | |
/// | |
/// </summary> | |
/// <typeparam name="T"></typeparam> | |
public class Switch<T> | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"title": "Design patterns and practices in .NET: the Adapter Pattern", | |
"link": "http://dotnetcodr.com/2013/04/25/design-patterns-and-practices-in-net-the-adapter-pattern/" | |
}, | |
{ | |
"title": "Design patterns and practices in .NET: the Strategy Pattern", | |
"link": "http://dotnetcodr.com/2013/04/29/design-patterns-and-practices-in-net-the-strategy-pattern/" | |
}, | |
{ |