![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C#
文章平均质量分 61
麻城BriceWu
这个作者很懒,什么都没留下…
展开
-
C# MVC 设置起始页
Area分区public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default",原创 2015-03-23 23:35:15 · 5631 阅读 · 3 评论 -
WPF+EntityFramework连接数据库之傻瓜闲扯蛋(VS2013+SQL 2012)
WPF连接SQL之EntityFramework1.新建解决方案,建一个WPF应用程序解决方案(其实这个随便啦,也可以建个空的解决方案。我这里只是图个方便)2.解决方案建好了,修理下它,拉长点,长高点(修改WPF界面的高度Height="600" 宽度Width="800",长宽自己随便设,仅是我喜欢600*800)。在这里你想让自家的房子有多高就能有多高(不然怎么说网络是虚拟的呢原创 2014-03-16 18:34:56 · 8313 阅读 · 3 评论 -
Linq
1.using (DbAppDataContext db = new DbAppDataContext()) { db.Log = Console.Out; //取出student var student = db.Students.SingleOrDefault(s => s.ID == id); if (stude转载 2015-05-21 21:52:09 · 455 阅读 · 0 评论 -
.NET Windows服务
1.新建Windows服务工程,选择的.NET环境为.net 4.02.双击Service查看代码3.添加代码using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Diagnostics;u转载 2015-05-06 08:37:08 · 832 阅读 · 0 评论 -
MVC 数据库连接
1.创建数据库2.创建表CREATE TABLE [dbo].[Student]( [ID] [INT] IDENTITY(1,1) NOT NULL, [Name] [NVARCHAR](30) NULL, [StudentNo] [NVARCHAR](20) NULL, [Age] [INT] NULL, [Sex] [NVARCHAR](2) NULL, [Descr原创 2015-03-25 23:54:10 · 7413 阅读 · 1 评论 -
反射 C#
1.写一个类,编译成dllusing System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ReflectTest{ public class TestClass { public int Totalizator(int a,int原创 2015-06-04 23:47:35 · 493 阅读 · 0 评论 -
C# MVC4环境下Uploadify 3.2.1上传文件
1.新建一个空的MVC4项目2.添加一个Home控制器,并在Home控制器下添加一个Index视图3.下载Flash版的uploadify,链接:Uploadify下载地址4.解压压缩包,得到下列文件 5.单击项目UploadifyDemo,右键添加新建文件夹Uploadify,并将加压得到的:uploadify.css,jquery.uploa原创 2015-04-25 23:59:55 · 4010 阅读 · 1 评论 -
CS0234: 命名空间“System.Web”中不存在类型或命名空间名称“Optimization”(是否缺少程序集引用?)
编译器错误消息: CS0234: 命名空间“System.Web”中不存在类型或命名空间名称“Optimization”(是否缺少程序集引用?)起因:在项目中,新建分区,编译运行,报错解决办法:将该分区的Views文件夹下面的Web.config文件中的这句注释掉 -->原创 2015-03-23 23:54:31 · 3810 阅读 · 0 评论 -
内存映射文件 C#
using System;using System.IO.MemoryMappedFiles;using System.Text;namespace MappedMemoryFiles{ class Program { static void Main(string[] args) { using (var mmFi转载 2015-11-03 00:06:43 · 1438 阅读 · 0 评论 -
C#委托 Delegate
class Program { static void Main(string[] args) { DelegateFather[] handers = { new Delegate(), new AnonymousDelgate(),原创 2015-11-02 22:24:18 · 757 阅读 · 0 评论 -
委托
using System;using System.Collections.Generic;using System.Linq;using System.Linq.Expressions;using System.Text;namespace ConsoleApp{ class Program { delegate bool DelCompare(in转载 2016-01-06 20:11:03 · 436 阅读 · 0 评论 -
什么是依赖注入?
原文链接:http://www.cnblogs.com/linjiancun/archive/2010/10/13/1849908.html依赖注入产生的背景:随着面向对象分析与设计的发展,一个良好的设计,核心原则之一就是将变化隔离,即:高内聚,低耦合。使得变化部分发生变化时,不变部分不受影响。为了做到这一点,要利用面向对象中的多态性,使用多态性后,客户类不再直接依赖服转载 2016-11-05 16:39:04 · 2251 阅读 · 0 评论 -
WPF隐藏菜单方向键
NavigationUIVisibility="Hidden"原创 2014-05-17 14:31:00 · 995 阅读 · 0 评论 -
迷你猜数
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace 迷你猜数{ class Program { static void Main(string[] args)原创 2015-03-23 23:20:45 · 682 阅读 · 0 评论 -
C#的装箱拆箱
1.装箱在值类型向引用类型转换时发生2.拆箱在引用类型向值类型转换时发生执行装箱操作时,不可避免的要在堆上申请内存空间,并将栈上的值类型数据复制到申请的堆内存空间上,无可避免的要消耗内存和CPU资源。拆箱操作过程反之转载 2015-09-02 00:29:46 · 467 阅读 · 0 评论 -
DataTable排序,去重
DataView dv = dt.DefaultView; dv.Sort = "产品编号 Asc";//升序 exportDataTable = dv.ToTable(true);//去重原创 2014-05-15 10:41:32 · 1098 阅读 · 0 评论 -
EXCEL与SQL数据库间导入导出之傻瓜闲扯淡
using System;using System.Collections.Generic;using System.Data;using System.Data.Odbc;using System.Data.SqlClient;using System.Diagnostics;using System.Linq;using System.Text;using System.Thr原创 2014-03-20 19:55:07 · 1190 阅读 · 0 评论 -
Linq示例
from c in db.Customersjoin o in db.Orders on c.CustomerIDequals o.CustomerID into ordersselect new{ c.ContactName, OrderCount = orders.Count()};from u in userslet number =转载 2015-09-01 22:17:05 · 553 阅读 · 0 评论 -
WPF编程学习——布局 StackPanel、WrapPanel、DockPanel、Canvas、Grid
转自:BARON LEE点击打开链接转载 2014-11-19 21:45:13 · 1333 阅读 · 0 评论 -
C# Json序列化 两种结构,三种方法
using System;using System.Collections.Generic;using System.Web.Script.Serialization;using System.Configuration;using System.Runtime.Serialization.Json;using System.Runtime.Serialization;using System.I原创 2014-11-17 23:54:04 · 6140 阅读 · 1 评论 -
根据条件查询返回DataTable
public DataTable GetDataTable(string tableName, string columnName, string queryCondition) { SqlConnection conn = new SqlConnection(ConnectionString); SqlData原创 2014-05-17 15:41:06 · 1421 阅读 · 0 评论 -
C# SQL操作数据库
C# SQL操作数据库using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Configuration;using System.Data;using System.Data.SqlCl原创 2015-09-10 22:01:23 · 744 阅读 · 0 评论 -
扩展方法
扩展方法被定义为静态方法,但它们是通过实例方法语法进行调用的。 它们的第一个参数指定该方法作用于哪个类型,并且该参数以 this 修饰符为前缀定义静态类中的静态(扩展)方法:public static class Extension{ public static int ToInt(this string str) { int val;原创 2015-08-27 23:18:52 · 408 阅读 · 0 评论 -
C# 多态(一)
面向对象三大特性:封装,继承,多态封装:1、在程序上,隐藏对象的属性和实现细节,仅对外公开接口,控制在程序中属性的读和修改的访问级别;将抽象得到的数据和行为(或功能)相结合,形成一个有机的整体,也就是将数据与操作数据的源代码进行有机的结合,形成“类”,其中数据和函数都是类的成员。继承:指一个对象直接使用另一对象的属性和方法。多态:是允许你将父对象设置成为和一个或转载 2015-05-09 11:56:10 · 748 阅读 · 0 评论 -
Additional information: The model backing the 'StuInfoDBContext' context has changed since the datab
异常:Additional information: The model backing the 'StuInfoDBContext' context has changed since the database was created. Consider using Code First Migrations to update the database 解决办法:原创 2015-03-26 00:07:47 · 3370 阅读 · 0 评论 -
内存映射+矩阵
接口:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace MemoryMatrix{ public interface IMemoryMapMatrix { /原创 2016-11-01 00:21:50 · 567 阅读 · 0 评论