Skip to content

Instantly share code, notes, and snippets.

View FWest98's full-sized avatar

Floris Westerman FWest98

View GitHub Profile
@FWest98
FWest98 / DynamicInvokers.cs
Last active August 29, 2015 14:13
Dynamic WinForm Control invoker
using System;
using System.Globalization;
using System.Linq;
using System.Windows.Forms;
namespace System.Windows.Forms {
public static class DynamicInvokers {
// This would replace a Control.Property = value
private delegate void SetPropertyCallBack(Control c, string property, dynamic value);
### Keybase proof
I hereby claim:
* I am FWest98 on github.
* I am fwest98 (https://keybase.io/fwest98) on keybase.
* I have a public key whose fingerprint is EB40 A06C 490B B16D C28F 7540 6394 EA2F 6F8F 92A1
To claim this, I am signing this object:
@FWest98
FWest98 / CustomHtmlGenerator.cs
Last active November 16, 2022 14:00
.NET Core 3 Custom Validation Classnames
using System.Collections.Generic;
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.Extensions.Options;
@FWest98
FWest98 / ConditionalValidationAttribute.cs
Created April 6, 2020 22:12
.NET Core 3 Conditional Model Validation Attribute
using System;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
namespace Foo {
// Implementation makes use of the IPropertyValidationFilter interface that allows
// control over whether the attribute (and its children, if relevant) need to be
// validated.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class ConditionalValidationAttribute : Attribute, IPropertyValidationFilter {
public string OtherProperty { get; set; }