
C#
文章平均质量分 53
adream307
这个作者很懒,什么都没留下…
展开
-
C#函数传递不定参数
<br /><br />using System;<br /> <br />class Min{<br /> public int MinVla(params int [] nums){<br /> int m;<br /> if (nums.Length == 0){<br /> Console.WriteLine("Error: no arguments.");<br /> return 0;<br /> }<b原创 2011-04-18 13:14:00 · 2709 阅读 · 0 评论 -
C#变量作用域
http://topic.youkuaiyun.com/u/20120830/13/DB72BEC5-DB6C-4C78-83AB-973F20BC2216.htmlusing System; class Test { static int t=0; static void Main() { int k=t; int t=1; Console.WriteLine("k="+k.ToS转载 2012-09-02 22:12:34 · 993 阅读 · 0 评论 -
C#实现UDP组播
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net;using System.Net.Sockets;using System.Threading;namespace Test{ class Program {原创 2012-11-27 17:53:13 · 15716 阅读 · 0 评论 -
C#实现UDP单播
单播和组播的不同点在于数据发送和接受的地址不是组播地址,而是网内的实际地址using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net;using System.Net.Sockets;using System.Threading;namesp原创 2012-11-27 17:57:31 · 4717 阅读 · 0 评论 -
C#实现UDP广播
向255.255.255.255发送UPD数据包即为UDP广播,接收端只需绑定UDP广播的端口号即可得到数据using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net;using System.Net.Sockets;using System.T原创 2012-11-27 18:00:37 · 19894 阅读 · 0 评论 -
智能手机屏幕解锁图案研究
1 2 34 5 67 8 9智能手机屏幕上的9个点依次记为1~9using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net;using System.Net.Sockets;using System.Thre原创 2012-11-27 18:21:50 · 7131 阅读 · 0 评论 -
[验证]TCP包头和校验不依赖于机器大小端
http://www.netfor2.com/checksum.htmlhttp://blog.youkuaiyun.com/li_xiang1102/article/details/6901660using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Ne原创 2012-11-27 22:08:57 · 1822 阅读 · 0 评论 -
计算24点C#代码
C#代码,并修正前门c++代码的一个bugusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;namespace Calc24Points{ public class Cell { public enum原创 2013-01-13 22:05:09 · 3264 阅读 · 0 评论 -
[C#]CRC16
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace CRCTest{ class Program { static void Main(string[] args) { byte[]原创 2013-10-31 16:25:55 · 1337 阅读 · 2 评论 -
C#程序开发中经常遇到的10条实用的代码
C#程序开发中经常遇到的10条实用的代码转载 2016-03-18 20:28:35 · 1120 阅读 · 0 评论 -
[C#]class和struct的区别
在C#中,class按引用传递,而struct则按值传递原创 2016-02-22 21:24:57 · 548 阅读 · 0 评论 -
一道C语言面试题
一头母牛从出生后,每两年可以生下一头母牛,即在第二年和第四年分别可产下一头母牛,出生后第五年将会死去。假设农场现有一头母牛,N年后农场的母牛数目是多少,编写程序实现。http://topic.youkuaiyun.com/u/20120828/12/8336bd43-4a3c-4b77-bf17-2fa854c3702e.html设在第n年时,当前出生的牛有x0头,已经出生1年的牛有x1头,2年的原创 2012-09-02 23:04:18 · 1036 阅读 · 0 评论 -
[C#]调用字符串中定义的函数
http://blogs.msdn.com/b/digitalnetbizz/archive/2004/01/31/create-assembly-in-memory-and-run-it.aspxusing System;using Specialized = System.Collections.Specialized;using Reflection = System.Reflec转载 2012-07-22 01:08:59 · 1643 阅读 · 0 评论 -
命名参数
<br /><br />using System;<br /> <br />class NamedArgsDemo{<br /> static bool IsFactor(int val, int divisor){<br /> if((val % divisor) == 0) return true;<br /> return false;<br /> }<br /> <br /> static void Main(){<br /> if(IsF原创 2011-04-18 13:49:00 · 845 阅读 · 0 评论 -
命令行编译WPF--VS2010
http://blog.youkuaiyun.com/eldersubhuti/archive/2010/07/07/5719160.aspx //SayHello.cs using System; using System.Windows; class SayHello { [STAThread] public static void Main() { Window win = new Window();原创 2011-04-21 13:10:00 · 1183 阅读 · 0 评论 -
Object Initializer 使用名字初始化类的成员或属性
using System; class MyClass{ public int Count{get;set;} public string Str{get;set;} } class MyClass2{ public int Count; public string Str; } class ObjInitDemo{ static void Main(){ MyClass obj = new原创 2011-04-25 10:15:00 · 995 阅读 · 0 评论 -
WPF多线程-1
先上代码:public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); Thread t = new Thread(new ParameterizedThreadStart(threadTest原创 2012-04-21 00:48:47 · 1058 阅读 · 0 评论 -
通过type获得class的Name
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace GetTypeName{ class GetTypeName { static void Main(string[] args) {原创 2012-05-30 23:33:17 · 1261 阅读 · 1 评论 -
C#多线程之信号量
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading;namespace SemaphoreTest{ class SemaphoreTest { static object m_lock = ne原创 2012-05-14 20:32:01 · 3250 阅读 · 0 评论 -
C#多线程之互斥
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading;namespace MutexTest{ class MutexTest { static object m_lock = new object原创 2012-05-14 20:32:55 · 4753 阅读 · 0 评论 -
C#关于引用
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ReferenceTest{ class A { //public int a { get; set; } public int a; pu原创 2012-05-31 23:13:12 · 824 阅读 · 0 评论 -
三枚硬币的概率问题
来自google groups的邮件列表黑盒中有三枚除颜色外一样的银币ABC,A两面都涂黑,B两面都涂红,C两面一红一黑。现在你从黑盒中拿出一枚银币放在桌上(你只看能到银币朝上一面的颜色),问,你猜对拿出银币的另一面颜色的概率有多少。 我看到了两种解释。 第一种答案是2/3,方法是你每次猜的颜色与拿出银币朝上面的颜色相同。理由是你从黑盒中拿出A或B银币(两面同色)的概率是2/3。 另一种答转载 2012-06-09 22:31:54 · 2669 阅读 · 0 评论 -
[C#]根据类的名称创建类
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Reflection;namespace CreateClassByName{ class A { public A() {原创 2012-07-06 22:35:09 · 5972 阅读 · 0 评论 -
[WPF]拖拽改变区域大小
WPF拖拽改变区域大小原创 2016-02-22 21:38:17 · 6128 阅读 · 0 评论