Skip to content

Instantly share code, notes, and snippets.

C#编码规范

概述

规范制定原则

  • 方便代码的交流和维护。
  • 不影响编码的效率,不与大众习惯冲突。
  • 使代码更美观、阅读更方便。
  • 使代码的逻辑更清晰、更易于理解。
@fzhenmei
fzhenmei / ConvertWord2Pdf.cs
Last active March 15, 2018 01:51
convert the word document .docx to pdf in .net
//https://www.codeproject.com/Questions/346784/How-to-convert-word-document-to-pdf-in-Csharp
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Office.Interop.Word;
public partial class Default2 : System.Web.UI.Page
@fzhenmei
fzhenmei / NaiveBayes.cs
Created November 3, 2017 08:59 — forked from hodzanassredin/NaiveBayes.cs
simple naive bayes classifier in c#
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
//original https://github.com/bazhenov/naive-bayes-example
namespace NaiveBayesianClasisifier
{
@fzhenmei
fzhenmei / SqlTableCreator.cs
Created September 4, 2017 06:29 — forked from riyadparvez/SqlTableCreator.cs
Create Sql table based on given DataTable schema
// Copyright (c) 2012-2013, Riyad Parvez
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
@fzhenmei
fzhenmei / SqlDbType2DbType.cs
Created April 26, 2017 02:21 — forked from tecmaverick/SqlDbType2DbType.cs
Convert .Net Type to SqlDbType or DbType and vise versa
//Convert .Net Type to SqlDbType or DbType and vise versa
//This class can be useful when you make conversion between types .The class supports conversion between .Net Type , SqlDbType and DbType .
using System;
using System.Collections;
using System.Data;
namespace Devintelligence.Common.Data
{
/// <summary>
@fzhenmei
fzhenmei / gist:1c3362d12c193c2e89da
Created June 24, 2014 03:29
WeDeploy 发布时不删除文件
WebDeploy.Web.deploy.cmd /Y -enableRule:DoNotDelete
@fzhenmei
fzhenmei / OracleDynamicParameters.cs
Last active August 29, 2015 14:02 — forked from vijayganeshpk/OracleDynamicParameters.cs
使用这个类替代 DynamicParameters 以解决 Dapper 调用 Oracle 存储过程不能处理返回游标的问题。
using Dapper;
using Oracle.ManagedDataAccess.Client;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
public class OracleDynamicParameters : Dapper.SqlMapper.IDynamicParameters {
private static Dictionary<SqlMapper.Identity, Action<IDbCommand, object>> paramReaderCache = new Dictionary<SqlMapper.Identity, Action<IDbCommand, object>>( );
public class WebApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
RouteTable.Routes.MapRoute("HttpProxy", "proxy/{*path}", new { controller = "Proxy", action = "Http" })
}
}
<s:form action="DataTransferTest">
<s:textfield name="ages" label="Ages"/>
<s:textfield name="ages" label="Ages"/>
<s:textfield name="ages" label="Ages"/>
<s:textfield name="names[0]" label="names"/>
<s:textfield name="names[1]" label="names"/>
<s:textfield name="names[2]" label="names"/>
<s:textfield name="middleNames[0]" label="middleNames"/>