· Observer Design Pattern in C#!--------------------------------------------------------------------------------Author Level
Ashish Dhar Intermediate This article describes a very important and one of the powerful tools in C#.This is based on a famous design pattern called Obs...
· Singleton Pattern in CSharp
Level Author
Beginner Kunal Cheda Singleton assures that there is one and only one instance of the class and provides a global point of access to it.There are number of cases in programming where you need to make sure that there can be one and on...
· 1、建立一个文本文件
public class FileClass
{
public static void Main()
{
WriteToFile();
}
static void WriteToFile()
{
StreamWriter SW;
SW=File.CreateText("c:\MyTextFile.txt");
SW.WriteLine("God is greatest of them all");...
· // Snippet shows how interfaces and coclasses can adorn the Guid attribute.
// Running the regasm will generate .reg and .tlb files. Reg file can be
// used to register the interface and coclass with the registry. Tlb file
// are used to do interop. Also illustrates how Sy...
· using System;
using System.Collections;
using System.Text;public class SamplesHashtable {
public static void Main() {
// Create and initialize a new Hashtable.
Hashtable table = new Hashtable();
//Student Name, Grade
table.Add("Jay&q...
· using System.Text.RegularExpressions;class Test {
static string CapText(Match m) {
// get the matched string
string x = m.ToString();
// if the first char is lower case
if (char.IsLower(x[0])) {
// capitalize it
return char.ToUpper(x[0]) + ...
· using System;
using System.Net;
using System.Text;
using System.Collections.Specialized;public class WebClientSample
{
public static void Main()
{
try {
// Download the data to a buffer
WebClient client = new WebClient(); ...
· This morning Microsoft announced that it will be releasing shared
source implementations of the .NET Common Language Infrastructure (CLI),
C# compiler, and ECMAscript compiler for both Windows and FreeBSD.
The license will be considerably more liberal than the shared source
...
· // indexedproperty.cs
using System;public class Document
{
// Type allowing the document to be viewed like an array of words:
public class wordCollection
{
readonly Document document; // The containing document internal wordCollection(Document d)
...
· Writing Secure Code using CSharpSubmitted ByUser LevelDate of SubmissionC.Vinodh KumarIntermediate04/06/2001
Mobile Code, which come from various sources like e-mail, documents and downloaded code over the Internet are the main cause for the damage, destroy or copy private da...
· using System.Text.RegularExpressions;
using System;class Validation
{
public static void Main()
{
String strToTest;
Validation objValidate=new Validation(); Console.Write("Enter a String to Test for Alphabets:");
strToTest=Console.ReadLine();
...
· 1.You write source code in C#. 2.You then compile it using the C# compiler (csc.exe) into an EXE. 3.The C# compiler outputs the MSIL code and a manifest into a read-only part of the EXE that has a standard PE (Win32-portable executable) header.
So far, so good. However, he...
· <%@ Import Namespace="System.Web.Security" %>
<HTML>
<head>
<script language="VB" runat=server>
' This function encrypts the input string using the SHA1 and MD5
' encryption algorithms
Sub encryptString(Src As Object, E As EventArgs...