Format:
Recent snippets matching tags of .NET
' I watched Karl's video about validation with custom rules, and wondered ' why Silverlight, ASP.NET and ASP.NET MVC had DataAnnotations, and ' WPF only had IDataErrorInfo. So I thought of using EF4 as the model, ' and generating a metadata class like in RIA, MVC, etc for WPF and a ' inheritable generic class to convert the validations between IDataErrorInfo ' and the DataAnnotation attributes. ' ' This way validation can happen the same way for each type of client! ' ' Let me know what you think please?
52 Views
no comments
Dim fc As New System.Drawing.Text.InstalledFontCollection Fonts = (From x In Enumerable.Range(0, fc.Families.Count) _ Select New With {.Id = x + 1, _ .Name = fc.Families(x).Name, _ .SortOrder = (x + 1) * 100}).ToList fc = Nothing
22 Views
no comments
Imports System.Net Imports System.Net.NetworkInformation Imports System.Threading Imports System.Text Public Class Form1 Private Sub SimpleButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpleButton1.Click MemoEdit1.Text = ""
23 Views
no comments
' Import ... Public Module EnvironmentEvents ' Autogenerated code ... Private Sub BuildEvents_OnBuildDone(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildDone If (DTE.ToolWindows.ErrorList.ErrorItems.Count = 0) Then SelectRootNode() DTE.ExecuteCommand("TestDriven.NET.RunTests")
48 Views
no comments
'------------------------------------------------------------------------------ ' <auto-generated> ' This code was generated from a template. ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' </auto-generated> '------------------------------------------------------------------------------ Option Compare Binary
46 Views
no comments
Try Habanero.Base.GlobalRegistry.ApplicationName = "IGD" Habanero.Base.GlobalRegistry.ApplicationVersion = "v1.0" HabaneroApplication = New Habanero.UI.Win.HabaneroAppWin(Habanero.Base.GlobalRegistry.ApplicationName, Habanero.Base.GlobalRegistry.ApplicationVersion) HabaneroApplication.ClassDefsXml = IGD.BO.BOBroker.GetClassDefsXml() If Not HabaneroApplication.Startup() Then Throw New Exception("Unable to start Habanero Application") End If
31 Views
no comments
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Response.Write(DropDownList1.SelectedValue); } protected void ButtonSave_Click(object sender, EventArgs e) { int n = SqlDataSource1.Insert(); if (n == 1) Response.Redirect("ViewGuestBook.aspx");
27 Views
no comments
public interface ICriteriaQuery<TEntity> { DetachedCriteria Criteria { get; } } public interface ILinqQuery<TEntity> { Expression<Func<TEntity, bool>> Expression { get; } }
58 Views
no comments
public static IEnumerable<TSource> Distinct<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> selector) { return source.Distinct(new SelectorEqualityComparer<TSource, TKey>(selector)); }
65 Views
no comments
public static IEnumerable<TSource> Distinct<TSource>(this IEnumerable<TSource> source, Func<TSource, TSource, bool> predicate) { return source.Distinct(new PredicateEqualityComparer<TSource>(predicate)); }
71 Views
no comments
[Serializable] public class SelectorEqualityComparer<TSource, Tkey> : EqualityComparer<TSource> { private Func<TSource, Tkey> selector; public SelectorEqualityComparer(Func<TSource, Tkey> selector) : base() { this.selector = selector; }
76 Views
no comments
[Serializable] public class PredicateEqualityComparer<T> : EqualityComparer<T> { private Func<T, T, bool> predicate; public PredicateEqualityComparer(Func<T, T, bool> predicate) : base() { this.predicate = predicate; }
53 Views
no comments
using System; using System.Linq; using System.Text; using System.Web.Mvc; using System.Web.Mvc.Html; using System.Web.Routing; namespace MvcSamples.Html { public static class UrlExtensions
205 Views
1 comments
/* Author: Mohammad Azam http://www.highoncoding.com This is a much better version than I demonstrated in the screencast! */
169 Views
no comments
{
"Fields":[
{
"FieldName":"Name",
"ReplaceValidationMessageContents":true,
"ValidationMessageId":"Name_validationMessage",
"ValidationRules":[
{
"ErrorMessage":"Meno musí mať 5 až 40 znakov.",
"ValidationParameters":{
118 Views
no comments
//Classe I want to resolve from ILogger but want to register public class AdvancedLogger : ILogger, IRequired { } public class OtherClass : IOtherInterface, IRequired { }
47 Views
no comments
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Configuration; using System.Data.OleDb; using System.Data.SqlClient; using System.Data;
61 Views
no comments
public class URLRewriterModule : IHttpModule { /// <summary> /// You will need to configure this module in the web.config file of your /// web and register it with IIS before being able to use it. For more information /// see the following link: http://go.microsoft.com/?linkid=8101007 /// </summary> #region IHttpModule Members public void Dispose()
69 Views
no comments
<Target Name="AfterMerge"> <ItemGroup> <JsFiles Include="$(TempBuildDir)\Scripts\infinitecarousel.js;$(TempBuildDir)\Scripts\jquery.autocomplete.js;$(TempBuildDir)\Scripts\core.js"/> <CssFiles Include="$(TempBuildDir)\Content\reset.css;$(TempBuildDir)\Content\infinitecarousel.css;$(TempBuildDir)\Content\Site.css" /> </ItemGroup> <ReadLinesFromFile File="%(JsFiles.Identity)"> <Output TaskParameter="Lines" ItemName="jsLines"/> </ReadLinesFromFile>
458 Views
no comments
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Text.RegularExpressions; using System.Reflection; using Activity_Search.Code; namespace Activity_Search.Controllers
80 Views
no comments
/// <summary>
/// Extension methods on HtmlHelper and UrlHelper that provide strongly-typed access to URLs and ActionLinks for AccountController actions
/// </summary>
public static class HelperExtensionsForAccountController
{
/// <summary>
/// Html Helpers for Controller = Account
/// </summary>
public static AccountControllerActionLinks Account(this HtmlHelper htmlHelper)
{
339 Views
no comments
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using System.Security; using System.Security.Permissions; using System.IO; using System.Security.Policy;
37 Views
no comments
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Security; using System.Security.Permissions; [assembly: AllowPartiallyTrustedCallers] [assembly: SecurityRules(SecurityRuleSet.Level2)] namespace TransparentSecurity
93 Views
no comments
using System; using System.Collections.Specialized; using System.Web; using System.IO; namespace ConfigFileExample.Services { public interface IConfigurationManager { NameValueCollection AppSettings { get; }
160 Views
2 comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
