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 class Upload | |
{ | |
public string Name { get; set; } | |
[FileSize(655360)] | |
[FileTypes("jpg,jpeg,png")] | |
public HttpPostedFileBase File { get; set; } | |
} | |
[HttpPost] | |
[Authorize] |
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
var a = 1, b = 4, c = 2; | |
c+=a++ + +b.toString() + ++a; |
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 class InMemoryCache: ICacheService | |
{ | |
public T Get<T>(string cacheID, Func<T> getItemCallback) where T : class | |
{ | |
T item = HttpRuntime.Cache.Get(cacheID) as T; | |
if (item == null) | |
{ | |
item = getItemCallback(); | |
HttpContext.Current.Cache.Insert(cacheID,item); | |
} |
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 Mvc4SampleApplication.Filters; | |
using System.Web; | |
using System.Web.Security; | |
using WebMatrix.WebData; | |
[assembly: PreApplicationStartMethod(typeof(PreApplicationTasks), "Initializer")] | |
public static class PreApplicationTasks | |
{ | |
public static void Initializer() |
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
<div class="span4 well"> | |
<form accept-charset="UTF-8" action="" method="POST"> | |
<textarea class="span4" id="new_message" name="new_message" placeholder="Type in your message" rows="5"></textarea> | |
<h6 class="pull-right">140 characters remaining</h6> | |
<p> | |
<button class="btn btn-primary btn-small" type="submit"> | |
Post Message</button> | |
<a class="btn btn-small" id="addImage">Show add image</a> | |
</p> | |
<div class="fileupload fileupload-new" data-provides="fileupload" style="display: none;" |
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
int length = strA.Length; | |
if (length != strB.Length) | |
return false; | |
fixed (char* chPtr1 = &strA.m_firstChar) | |
fixed (char* chPtr2 = &strB.m_firstChar) | |
{ | |
char* chPtr3 = chPtr1; | |
char* chPtr4 = chPtr2; | |
while (length >= 10) | |
{ |
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.Collections.Generic; | |
using System.IO; | |
using System.Xml; | |
using System.Xml.Serialization; | |
namespace ConvertorApplication | |
{ | |
public class Convertors | |
{ | |
/// <summary> |
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
if (oDs.Tables.Count > 1) | |
{ | |
oDs.Tables[1].Rows.Cast<DataRow>() | |
.Where(r => | |
r["first"].ToString() == "0" || | |
r["second"].ToString() == "5" || | |
r["third"].ToString() == "000") | |
.ToList() | |
.ForEach(row => | |
{ |
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
[SuppressUnmanagedCodeSecurity] | |
internal static class SafeNativeMethods | |
{ | |
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode)] | |
public static extern int StrCmpLogicalW(string psz1, string psz2); | |
} | |
public sealed class NaturalStringComparer : IComparer<string> | |
{ | |
public int Compare(string a, string b) |
OlderNewer