Skip to content

Instantly share code, notes, and snippets.

View jcdickinson's full-sized avatar
🐵

Jonathan Dickinson jcdickinson

🐵
View GitHub Profile
@jcdickinson
jcdickinson / PrimaryAppDomainManager.Net35.cs
Created February 8, 2011 08:07
.Net 3.5 Primary AppDomain Manager
/// <summary>
/// Represents a <see cref="AppDomainManager"/> that is
/// aware of the primary application AppDomain.
/// </summary>
public class PrimaryAppDomainManager : AppDomainManager
{
private static AppDomain _primaryDomain;
/// <summary>
/// Gets the primary domain.
@jcdickinson
jcdickinson / RandomAccessReader.cs
Created February 9, 2011 12:46
A Memoizing Text Reader
/// <summary>
/// Represents a way to access a text stream
/// using random access (lines only).
/// </summary>
public class RandomAccessReader : IDisposable
{
private List<long> _lineOffsets
= new List<long>();
/// <summary>
@jcdickinson
jcdickinson / TypeAttributesResults.txt
Created February 9, 2011 20:24
Type Attributes as C# Sees Them
--- OUTPUT ---
NonNestedClass: AutoLayout, AnsiClass, NotPublic, BeforeFieldInit
PublicClass: AutoLayout, AnsiClass, NotPublic, Public, BeforeFieldInit
NestedInternalClass: AutoLayout, AnsiClass, NotPublic, NestedAssembly, BeforeFieldInit
NestedProtectedClass: AutoLayout, AnsiClass, NotPublic, NestedFamily, BeforeFieldInit
NestedProtectedInternalClass: AutoLayout, AnsiClass, NotPublic, NestedFamORAssem, BeforeFieldInit
PrivateClass: NotPublic, NestedPrivate
--- LESS GARBAGE ---
NonNestedClass: NotPublic
@jcdickinson
jcdickinson / MonoTypeAttributeHelper.cs
Created February 9, 2011 20:33
Simplify Cecil TypeAttributes
[Flags]
public enum CSharpTypeAttributes
{
Private = 0,
Public = 1,
Internal = 2,
Protected = 4,
ProtectedInternal = Protected | Internal,
}
test
public System.CodeDom.Compiler.CodeDomProvider CreateProvider(System.Collections.Generic.IDictionary providerOptions)
{
System.Reflection.ConstructorInfo constructorInfo1;
System.Type[] typeArray1;
object[] objectArray1;
object[] objectArray1; // No idea why it generates the same name twice.
if (!providerOptions)
{
throw new System.ArgumentNullException("providerOptions");
}

SQL Tables

Subscriber

ID BIGINT PRIMARY IDENTITY, SoapEndpoint NVARCHAR(256), Escalation INT, Other Metadata

@jcdickinson
jcdickinson / LanguageSelector.cs
Created February 14, 2011 15:34
Selectors for MEF
[Export(typeof(LanguageSelector))]
[PartCreationPolicy(CreationPolicy.Shared)]
public class LanguageSelector : Selector<ILanguageProvider>
{
protected override string IdentityFor(ILanguageProvider import)
{
return import.Name;
}
protected override ILanguageProvider ImportFor(string identity)
<Plugin xmlns="http://schemas.monoflector.org/plugins/2011/definition"
Identity="plugins.monoflector.org/Windows/Forms"
Version="1.0.0.0">
<Title>Windows Forms</Title>
<Author>Monoflector Project</Author>
<Description>Required windows functionality.</Description>
<InstallDocumentation>InstallDoc</InstallDocumentation>
<Deployment xmlns:files="http://schemas.monoflector.org/plugins/2011/deployment/files"
xmlns:mef="http://schemas.monoflector.org/plugins/2011/deployment/mef">
<PluginConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.monoflector.org/plugins/2011/configuration">
<Normal>
<Plugin Identity="plugins.monoflector.org/Languages/CSharp" Active="true">
<Export>Monoflector.CSharp.dll</Export>
</Plugin>
<Plugin Identity="plugins.monoflector.org/Windows/Core" Active="true">
<Export>Monoflector.Windows.dll</Export>
</Plugin>
<Plugin Identity="plugins.monoflector.org/Windows/Forms" Active="true">
<Export>Monoflector.WindowsForms.dll</Export>