首页 > 编程 > C# > 正文

C#学习笔记之二(stack, queue, string, HashTable,StringBui

2024-07-21 02:19:43
字体:
来源:转载
供稿:网友
  • 本文来源于网页设计爱好者web开发社区http://www.html.org.cn收集整理,欢迎访问。
  • queue:
    enqueue()
    dequeue()
    peek() //only get first element, not delete it
    stack:
    count()
    clear()
    peek()
    pop()
    push()
    copyto(array, offset) //copy to array
    dictionary/hashtable:
    keys //colleation of keys,
    values //colleation of value
    count()
    clear()
    contains() // is element in hashtable
    containskey() // is key in hashtable
    item() //indexer for hashtable
    add() // add entry with key/value
    getenumerator() // creat and return a enumator object
    strings:
    string
    compare() split()
    concat() startswith()
    equals() tolower()/toupper()
    insert() trim()
    format()
    string.compare(s1,s2); //case sensitive
    string.compare(s1,s2, true) //case not sensitive
    string s3 = @"test / .net"
    string s6 string.copy(s5);
    string s7 = s6
    s7 == s6
    s7.equals(s6)
    string.equals(s7,s6)
    s7.length
    s3.endwith("test")
    int offset = s3.indexof("test") //first occurence
    string s10 = s3.insert(offset, "ddd");
    string s11 = s3.insert(s3.indexof("ddd"), "eee");
    s12.split(delimiters)
    regex r = new regex(" |,");
    foreach( string s in r.split(s12)) {}
    stringbuilder
    stringbuilder sb = new stringbuild();
    append()
    tostring()
    regular expresstions:
    using system.text.regularexpressions;
    发表评论 共有条评论
    用户名: 密码:
    验证码: 匿名发表