Skip to content

Instantly share code, notes, and snippets.

View EifelMono's full-sized avatar

Andreas Klapperich EifelMono

View GitHub Profile
@EifelMono
EifelMono / VersionExtention.cs
Last active August 29, 2015 13:56
Compare of version number as Extention
using System;
using System.Collections.Generic;
/* Sample
class MainClass
{
public static void Main(string[] args)
{
@EifelMono
EifelMono / propf
Last active August 29, 2015 13:56
Code Template propf => property with member field
#region Property $name$
private $type$ m_$name$= $value$;
public $type$ $name$
{
get
{
return m_$name$;
}
@EifelMono
EifelMono / EnumConverter.cs
Created March 22, 2014 18:20
EnumConverter for differerent enum <-> text handling
using System;
using System.Reflection;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
namespace EifelMono.Core
{
// [Obsolete ("Property is deprecated please use Property instead.")]
@EifelMono
EifelMono / IndexedProperty.cs
Last active August 29, 2015 13:57
IndexedProperty
using System;
using System.Reflection;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
namespace EifelMono.Core
{
// [Obsolete ("Property is deprecated please use Property instead.")]
@EifelMono
EifelMono / FindInitializationAndCall.pas
Last active August 29, 2015 13:58
Call Delphi initialization section
procedure FindInitializationAndCall;
var
nameSpace: string;
foundName: string;
helperType: System.Type;
begin
for helperType in Assembly.GetExecutingAssembly.GetTypes do
begin
nameSpace:= helperType.Namespace;
if Assigned(nameSpace) then
@EifelMono
EifelMono / ClassHelper.cs
Last active August 29, 2015 13:58
ClassHelper for Initialization and Finalization calls of a class
using System;
using System.Reflection;
namespace Utils
{
[AttributeUsage(AttributeTargets.Method)]
public sealed class InitializationAttribute : Attribute
{
public InitializationAttribute()
{
@EifelMono
EifelMono / AutoGenerateBindingRedirects
Created May 13, 2014 05:26
Problems with Assembly Versions
Add this
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
to the frist
<PropertyGroup>
:
:
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
:
@EifelMono
EifelMono / Instance.cs
Created June 16, 2014 05:49
IInstance
using System;
using System.Collections.Generic;
using System.Text;
namespace EifelMono
{
public interface IInstance<T>
{
T Instance { get; }
@EifelMono
EifelMono / Instance.cs
Created June 17, 2014 06:21
Instance, SingleInstance, MultiInstance
using System;
using System.Collections.Generic;
using System.Text;
namespace EifelMono
{
public class Instance<T>
{
public Instance()
{
@EifelMono
EifelMono / KeepAlive.cs
Created July 8, 2014 07:20
KeepAliveExtention
public static void UseKeepAlive(this TcpClient client, ulong time = 2000, ulong interval = 500)
{
if (client == null)
return;
// "consts" to help understand calculations
const int bytesperlong = 4; // 32 / 8
const int bitsperbyte = 8;
try
{