標籤:1 UI 2 code 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 9 using
標籤:用兩種方法編寫題目:輸入姓名,語文分數,數學分數,英語分數到集合,求語文總分,數學平均分,英語最高分以及英語最高分是誰。法一:一個集合的做法 Console.Write("輸入總人數:"); int s = int.Parse(Console.ReadLine()); ArrayList ss = new ArrayList(); for (int i = 0; i < s; i++)
標籤:6.0增加了 字串嵌入值 的新文法糖。以前我們做拼接的時候,一般這樣寫 var s = string.Format("this is a {0} !!!" , class1.p1);寫一個兩個的預留位置還能記得住,要是長了,10幾個的時候,可能就有點兒亂了。 在VS2015下,就可以這麼簡單的寫了 var s = $"this is a {class1.p1} !!!"; $相當於@這種轉義符, {}
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace Example { class Program { static void Main(string[] args) { //////////////// 檔案開啟 下面的代碼開啟D:
一、@dynamic與@synthesize的區別@property有兩個對應的詞,一個是@synthesize,一個是@dynamic。如果@synthesize和@dynamic都沒寫,那麼預設的就是@syntheszie var = _var; @synthesize的語義是如果你沒有手動實現setter方法和getter方法,那麼編譯器會自動為你加上這兩個方法。
C#分別用前序走訪、中序遍曆和後序遍曆列印二叉樹public class BinaryTreeNode{ public BinaryTreeNode Left { get; set; } public BinaryTreeNode Right { get; set; } public int Data { get; set; } public BinaryTreeNode(int data) { this.Data = data; }
C#尋找字串的所有排列組合// 1. remove first char// 2. find permutations of the rest of chars// 3. Attach the first char to each of those permutations.// 3.1 for each permutation, move firstChar in all indexes to produce even more permutations.// 4. Return