博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C#面试题
阅读量:4445 次
发布时间:2019-06-07

本文共 1363 字,大约阅读时间需要 4 分钟。

1.素数问题

①一般方法

class Program    {        static void Main(string[] args)        {            for (int i = 2; i < 100; i++)            {                bool f = true;                for (int j = 2; j < i; j++)                {                    if (i % j == 0)                    {                        f = false;                    }                }                if (f)                {                    Console.WriteLine("素数:" + i);                }            }           Console.ReadLine();        }    }

 

②最简单素数求法

using System;class Test{    public static void Main()    {        int i;        Console.WriteLine (2);        Console.WriteLine (3);        Console.WriteLine (5);        Console.WriteLine (7);        for(i=2;i<=1000;i++)        {            if((i%2!=0)&&(i%3!=0)&&(i%5!=0)&&(i%7!=0))            {                Console.WriteLine (i+"\t");            }        }    }}

 

2.如何把一个Array复制到ArrayList里

(1) 实现1

string[] s ={ “111″, “22222″ };ArrayList list = new ArrayList();list.AddRange(s);

(2)实现2

string[] s ={ “111″, “22222″ };ArrayList list = new ArrayList(s);

 

3.sealed 修饰符有什么特点

     sealed 修饰符可以应用于类、实例方法和属性。密封类不能被继承。密封方法会重写基类中的方法,但其本身不能在任何派生类中进一步重写。当应用于方法或属性时,sealed 修饰符必须始终与 override一起使用。 

 

4.列举ASP.NET 页面之间传递值的几种方式

    (1)使用QueryString, 如 response. Redirect()....

    (2)使用Session变量
    (3)使用Server.Transfer

 

 

转载于:https://www.cnblogs.com/code1992/p/3432221.html

你可能感兴趣的文章
浅谈软件测试与墨菲定律
查看>>
文件安全复制之 FastCopy
查看>>
强烈推荐美文之《从此刻起,我要》
查看>>
MYSQL中数据类型介绍
查看>>
评估软件上线标准
查看>>
敏捷开发流程
查看>>
APP兼容性测试(三)测试方案设计
查看>>
React的性能优化 - 代码拆分之lazy的使用方法
查看>>
在canvas中使用其他HTML元素
查看>>
React的新特性 ---- Hooks ---- 的基本使用
查看>>
History Introduction to Mining Industry of Czech
查看>>
富文本框
查看>>
动态网页开发基础
查看>>
mysql 恢复备份
查看>>
LeetCode-Create Maximum Number
查看>>
随想之三 -CMDB
查看>>
STM32的DMA
查看>>
Process Class (System.Diagnostics)
查看>>
hdu 3001
查看>>
手机端H5上滑加载下一页
查看>>