C#实例代码
using System;
namespace LineApplication {
class Line {
private double length;// Length of a line
public Line(double len) {//Parameterized constructor
时间:2022-07-04
using System;
namespace LineApplication {
class Line {
private double length;// Length of a line
public Line() {
时间:2022-07-04
using System;
namespace BoxApplication {
class Box {
private double length;// Length of a box
private double breadth;// Breadth of a box
时间:2022-07-04
using System;
namespace BoxApplication {
class Box {
public double length;// Length of a box
public double breadth;// Breadth of a box
时间:2022-07-04
using System;
namespace EnumApplication {
class EnumProgram {
enum Days { Sun, Mon, tue, Wed, thu, Fri, Sat };
时间:2022-07-04
using System;
struct Books {
private string title;
private string author;
private string subject;
private int book_id;
时间:2022-07-04
using System;
struct Books {
public string title;
public string author;
public string subject;
public int book_id;
时间:2022-07-04
using System;
namespace yiibai {
class Student {
private string code = "N.A";
private string name = "not known";
时间:2022-07-04
using System;
using System.Reflection;
namespace BugFixApplication {
//a custom attribute BugFix to be
//assigned to a class and its members
时间:2022-07-04
using System;
public class MyClass {
[Obsolete("Don't use OldMethod, use NewMethod instead", true)]
时间:2022-07-04
#define DEBUG
using System;
using System.Diagnostics;
public class Myclass {
[Conditional("DEBUG")]
时间:2022-07-04
using System;
using System.IO;
namespace BinaryFileApplication {
class Program {
static void Main(string[] args) {
时间:2022-07-04
using System;
using System.IO;
namespace FileApplication {
class Program {
static void Main(string[] args) {
时间:2022-07-04
using System;
using System.IO;
namespace FileIOApplication {
class Program {
static void Main(string[] args) {
时间:2022-07-04
using System;
namespace UserDefinedException {
class TestTemperature {
static void Main(string[] args) {
时间:2022-07-04
using System;
namespace ErrorHandlingApplication {
class DivNumbers {
int result;
DivNumbers() {
result = 0;
时间:2022-07-04
using System;
using System.Text.RegularExpressions;
namespace RegExApplication {
class Program {
static void Main(string[] args) {
时间:2022-07-04
using System;
using System.Text.RegularExpressions;
namespace RegExApplication {
class Program {
private static void showMatch(string text, string expr) {
时间:2022-07-04
using System;
using System.Text.RegularExpressions;
namespace RegExApplication {
class Program {
private static void showMatch(string text, string expr) {
时间:2022-07-04
#define DEBUG
#define VC_V10
using System;
public class TestClass {
public static void Main() {
#if (DEBUG && !VC_V10)
时间:2022-07-04
#define PI
using System;
namespace PreprocessorDAppl {
class Program {
static void Main(string[] args) {
时间:2022-07-04
using System;
using first_space;
using first_space.second_space;
namespace first_space {
class abc {
public void func() {
时间:2022-07-04
using System;
using first_space;
using second_space;
namespace first_space {
class abc {
public void func() {
时间:2022-07-04
using System;
namespace first_space {
class namespace_cl {
public void func() {
Console.WriteLine("Inside first_space");
时间:2022-07-04
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
namespace InterfaceApplication {
时间:2022-07-04
using System;
namespace UnsafeCodeApplication {
class Program {
static unsafe void Main(string[] args) {
时间:2022-07-04
using System;
delegate void NumberChanger(int n);
namespace DelegateAppl {
class TestDelegate {
static int num = 10;
时间:2022-07-04
using System;
using System.Collections.Generic;
delegate T NumberChanger<T>(T n);
namespace GenericDelegateAppl {
时间:2022-07-04
using System;
using System.Collections.Generic;
namespace GenericMethodAppl {
class Program {
static void Swap<T>(ref T lhs, ref T rhs) {
时间:2022-07-04
using System;
using System.Collections.Generic;
namespace GenericApplication {
public class MyGenericArray<T> {
时间:2022-07-04