Format:
Recent snippets matching tags of C#
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data.Linq; namespace HelpDesk.Models { public interface IGenericRepository { IQueryable<T> Get<T>() where T : class; void Insert<T>(T item) where T : class;
9 Views
no comments
public IEntity GetFromReader(IDataReader reader) { QueueItem entity = new QueueItem(); entity.PrimaryQueueID = DataMapper.IsNull<long>(reader["PrimaryQueueID"], new long()); entity.PaymentRequest = DataMapper.IsNull<string>(reader["PaymentRequest"], string.Empty); return (IEntity)entity; }
6 Views
no comments
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Xml; using System.Runtime.Serialization; using System.Data.Linq; using System.Data.Linq.Mapping; using System.Linq.Expressions;
24 Views
no comments
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="HL7v2xConformanceProfile"> <xs:annotation> <xs:documentation>An unambiguous specification of one or more standard HL7 messages that have been analyzed for a particular use case. It prescribes a set of precise constraints upon one or more standard HL7 messages.</xs:documentation> <xs:appinfo> <sch:pattern name="Check for no optionality in Implementation profiles"> <sch:rule context="HL7v2xConformanceProfile"> <sch:report test="@ProfileType='Implementation' and count(HL7v2xStaticDef/descendant::*[@Usage='O'])!=0">May not have elements with a Usage of 'O' in an Implementation profile.</sch:report> </sch:rule>
18 Views
no comments
// The view: Index.aspx <!-- the non-AJAX form to filter the list --> <% using (Html.BeginForm()) { %> <fieldset> <legend>Search</legend> <input name="SearchTerm" /> <input type="submit" value="Go" /> </fieldset> <% } %>
21 Views
no comments
// // GlossaryController.cs public ActionResult Index() { return View(Models.Term.SelectAll()); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Index(FormCollection collection)
21 Views
no comments
var _Offspring = _Context.Users
.SelectMany(x => x.Offspring).Distinct();
13 Views
no comments
// handle the completed event _Service.MyMethodCompleted += (s, e) => { // an Action is just a built-in delegate Action _Action = () => { // access the UI here this.MyLabel.Text = e.Result; } // change the thread context
16 Views
no comments
dynamic _Dynamic = new ExpandoObject(); _Dynamic.Color = "Brown"; _Dynamic.Print = new Action(() => { Console.Write(_Dynamic.Color); }); _Dynamic.Print();
18 Views
no comments
private void button_Click(object sender, EventArgs e) { // pass in the containing panel LoadControl<MyControls.MyControl>(panelContainer); } void LoadControl<T>(Panel panel) where T : Control, new() { T _Control = GetControl<T>(panel); if (_Control == null)
19 Views
no comments
<#@ template language="C#v3.5" hostspecific="True" debug="True" #> <#@ output extension="cs" #> <#@ assembly name="Microsoft.SqlServer.ConnectionInfo" #> <#@ assembly name="Microsoft.SqlServer.Smo" #> <#@ assembly name="System.Data" #> <#@ import namespace="Microsoft.SqlServer.Management.Smo" #> <#@ import namespace="Microsoft.SqlServer.Management.Common" #> <#@ import namespace="System.Data.SqlClient" #> <#@ import namespace="System.Collections.Specialized" #> <#
29 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;
15 Views
no comments
// LivePreviewPlugin.cs // using System; using System.Collections; using System.Html; using System.Runtime.CompilerServices; using jQueryApi; [Imported]
263 Views
1 comments
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; namespace Nixoncorp.LoopPerformance { class Test {
47 Views
no comments
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; namespace Nixoncorp.LoopPerformance { class Test {
17 Views
no comments
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Text.RegularExpressions; class Program { static void Main(string[] args) { Console.WriteLine("IFC Source File:");
16 Views
no comments
using System; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { //ავიღოთ რაიმე სტრინგი string s = "me miyvars samyaro imitom rom mze amodis da natels fens yovels"; //გადავიყვანოთ ბაიტების მასივში, რადგან Convert.ToBase64String ბაიტის მასივს იღებს პარამეტრად byte[] strBytes = Encoding.ASCII.GetBytes(s);//თუ გაქვთ უნიკოდური ტექსტი უნდა გამოიყენოთ შესაბამისი კლასი. მაგ Encoding.Unicode
25 Views
no comments
using System; using System.Collections.Specialized; using System.Web; using System.IO; namespace ConfigFileExample.Services { public interface IConfigurationManager { NameValueCollection AppSettings { get; }
42 Views
2 comments
public int CryptoHash(string strValue)
{
int hashCode = 0;
if (strValue ! = null)
{
byte[ ] encodedUnHashedString =
Encoding. Unicode. GetBytes(strValue) ;
byte[ ] key = new byte[ 16] ;
RandomNumberGenerator. Create( ). GetBytes(key);
MACTripleDES hashingObj = new MACTripleDES(key) ;
17 Views
no comments
using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.InteropServices; using System.Text;
24 Views
no comments
public enum StyleConditions { IE6OrLess, IE7OrLess } public static class HtmlHelpers { #region Image public static string Image(this HtmlHelper helper, string route, string action, int id, int height, int width, int imageType, string altText, string cssClass) { var urlHelper = new UrlHelper(helper.ViewContext.RequestContext); var imageUrl = urlHelper.RouteUrl(route, new RouteValueDictionary(new {
242 Views
no comments
//without using Object Initializer Syntax letter = new Letter(); letter.Date = DateTime.Now.Date; letter.RegisterDate = DateTime.Now.Date; letter.LetterType = LetterType.Outgoing; letter.LetterInformation = new LetterInformation(); letter.LetterInformation.RuntimeState = common.RuntimeState.Added; letter.LetterInformation.Letter = letter;
53 Views
1 comments
public static void ResizeImage() { using (Bitmap src = new Bitmap(_ImgOriginal)) { int destWidth = (int)(0.5 * src.Width); int destHeight = (int)(0.5 * src.Height); using (Bitmap dest = new Bitmap(destWidth, destHeight)) using (Graphics gDest = Graphics.FromImage(dest)) {
26 Views
no comments
public List<PersonInOrganization> ExtractInvalidEmails() { EntityCollection<PersonInOrganization> list = GetAllItems(); //my first LINQ use! var invalids = from l in list where !string.IsNullOrEmpty(l.Email) && !IsValidEmail(l.Email) select l; return invalids.ToList<PersonInOrganization>(); }
40 Views
1 comments
using System; namespace SharpVM { /// <summary> /// http://pastebin.com/f22e2c91 /// /// A little playground for VM and JIT testing. The basic idea is to have an instruction set that is /// EXTREMELY EASY to decode: we prefer more instructions versus complex decoding logic. For example, /// most opcodes have a W version that lets the last argument (usually a word) take up an entire
46 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
