dnrops.gitlink.net/posts/cs/cs.html

649 lines
79 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML>
<html lang="en" class="sidebar-visible no-js coal">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>C# - Andrew&#x27;s Blog</title>
<!-- Custom HTML head -->
<meta name="description" content="Andrew Ryan&#x27;s Blog">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff" />
<link rel="icon" href="../../favicon.svg">
<link rel="shortcut icon" href="../../favicon.png">
<link rel="stylesheet" href="../../css/variables.css">
<link rel="stylesheet" href="../../css/general.css">
<link rel="stylesheet" href="../../css/chrome.css">
<!-- Fonts -->
<link rel="stylesheet" href="../../FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="../../fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="../../highlight.css">
<link rel="stylesheet" href="../../tomorrow-night.css">
<link rel="stylesheet" href="../../ayu-highlight.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="../../src/style/custom.css">
<!-- MathJax -->
<script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</head>
<body>
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "../../";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "coal" : "coal";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('no-js')
html.classList.remove('coal')
html.classList.add(theme);
html.classList.add('js');
</script>
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var html = document.querySelector('html');
var sidebar = null;
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
html.classList.remove('sidebar-visible');
html.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item affix "><a href="../../index.html">Andrew's Blog</a></li><li class="chapter-item "><a href="../../posts/linux/linux.html"><strong aria-hidden="true">1.</strong> Linux</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/linux/install_linux.html"><strong aria-hidden="true">1.1.</strong> install linux</a></li><li class="chapter-item "><a href="../../posts/linux/bash_profile.html"><strong aria-hidden="true">1.2.</strong> bash profile</a></li><li class="chapter-item "><a href="../../posts/linux/command_list.html"><strong aria-hidden="true">1.3.</strong> command list</a></li><li class="chapter-item "><a href="../../posts/linux/git_guide.html"><strong aria-hidden="true">1.4.</strong> git guide</a></li><li class="chapter-item "><a href="../../posts/linux/tar.html"><strong aria-hidden="true">1.5.</strong> tar</a></li><li class="chapter-item "><a href="../../posts/linux/git_cheatsheet.html"><strong aria-hidden="true">1.6.</strong> Git Cheatsheet</a></li><li class="chapter-item "><a href="../../posts/linux/bash_cheatsheet.html"><strong aria-hidden="true">1.7.</strong> Bash Cheatsheet</a></li></ol></li><li class="chapter-item "><a href="../../posts/macos/mac.html"><strong aria-hidden="true">2.</strong> MacOS</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/macos/macos_profiles.html"><strong aria-hidden="true">2.1.</strong> macos profiles</a></li><li class="chapter-item "><a href="../../posts/macos/macos_pwn_env_setup.html"><strong aria-hidden="true">2.2.</strong> macos pwn env setup</a></li></ol></li><li class="chapter-item "><a href="../../posts/windows/windows.html"><strong aria-hidden="true">3.</strong> Windows</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/windows/windows.html"><strong aria-hidden="true">3.1.</strong> Windows</a></li><li class="chapter-item "><a href="../../posts/windows/windows10_use_powershell_dedup_redundent_path.html"><strong aria-hidden="true">3.2.</strong> Windows10 use PowerShell dedup redundent PATH</a></li></ol></li><li class="chapter-item expanded "><a href="../../posts/cs/cs.html" class="active"><strong aria-hidden="true">4.</strong> C#</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/cs/learn_cs_basics.html"><strong aria-hidden="true">4.1.</strong> Learn C# Basics</a></li></ol></li><li class="chapter-item "><a href="../../posts/swift/swift.html"><strong aria-hidden="true">5.</strong> Swift</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/swift/learn_swift.html"><strong aria-hidden="true">5.1.</strong> learn swift basics</a></li><li class="chapter-item "><a href="../../posts/swift/swift_extensions.html"><strong aria-hidden="true">5.2.</strong> Swift extensions</a></li><li class="chapter-item "><a href="../../posts/swift/swiftui_extension.html"><strong aria-hidden="true">5.3.</strong> SwiftUI extensions</a></li><li class="chapter-item "><a href="../../posts/swift/install_swift.html"><strong aria-hidden="true">5.4.</strong> install swift</a></li><li class="chapter-item "><a href="../../posts/swift/task_planner.html"><strong aria-hidden="true">5.5.</strong> implment task panner app with SwiftUI</a></li><li class="chapter-item "><a href="../../posts/swift/swift_cheat_sheet.html"><strong aria-hidden="true">5.6.</strong> Swift Cheat Sheet</a></li><li class="chapter-item "><a href="../../posts/swift/yinci_url.html"><strong aria-hidden="true">5.7.</strong> Personal privacy protocol</a></li><li class="chapter-item "><a href="../../posts/swift/swift_regular_exressions.html"><strong aria-hidden="true">5.8.</strong> Swift regular exressions</a></li><li class="chapter-item "><a href="../../posts/ios/how_to_create_beautiful_ios_charts_in_swift.html"><strong aria-hidden="true">5.9.</strong> How to Create Beautiful iOS Charts in Swift</a></li><li class="chapter-item "><a href="../../posts/swift/swiftui_source_code.html"><strong aria-hidden="true">5.10.</strong> SwiftUI source code</a></li><li class="chapter-item "><a href="../../posts/swift/use_swift_fetch_iciba_api.html"><strong aria-hidden="true">5.11.</strong> use swift fetch iciba API</a></li></ol></li><li class="chapter-item "><a href="../../posts/ios/ios.html"><strong aria-hidden="true">6.</strong> iOS</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/ios/cocaposd_setup_and_install_for_ios_project.html"><strong aria-hidden="true">6.1.</strong> cocaposd setup and install for ios project</a></li><li class="chapter-item "><a href="../../posts/ios/swiftui_show_gif_image.html"><strong aria-hidden="true">6.2.</strong> SwiftUI show gif image</a></li><li class="chapter-item "><a href="../../posts/ios/implement_task_planner_app.html"><strong aria-hidden="true">6.3.</strong> implement Task planner App</a></li></ol></li><li class="chapter-item "><a href="../../posts/objective_c/objective_c.html"><strong aria-hidden="true">7.</strong> Objective-C</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/objective_c/objective_c_cheat_sheet.html"><strong aria-hidden="true">7.1.</strong> Objective-C Cheat Sheet</a></li><li class="chapter-item "><a href="../../posts/objective_c/objective_c_for_absolute_beginners_read_note.html"><strong aria-hidden="true">7.2.</strong> Objective-C Note</a></li></ol></li><li class="chapter-item "><a href="../../posts/dart/dart.html"><strong aria-hidden="true">8.</strong> Dart</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/dart/flutter.html"><strong aria-hidden="true">8.1.</strong> Flutter Cheat Sheet</a></li><li class="chapter-item "><a href="../../posts/dart/dart_cheat_sheet.html"><strong aria-hidden="true">8.2.</strong> Dart Cheat Sheet</a></li><li class="chapter-item "><a href="../../posts/dart/flutter_dev_test.html"><strong aria-hidden="true">8.3.</strong> Flutter Dev Test</a></li></ol></li><li class="chapter-item "><a href="../../posts/rust/rust.html"><strong aria-hidden="true">9.</strong> Rust</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/rust/offline_use_rust.html"><strong aria-hidden="true">9.1.</strong> Offline use rust</a></li><li class="chapter-item "><a href="../../posts/rust/rust_grammer.html"><strong aria-hidden="true">9.2.</strong> rust grammar</a></li><li class="chapter-item "><a href="../../posts/rust/pase_string_and_decimal_conversion.html"><strong aria-hidden="true">9.3.</strong> pase string and decimal conversion</a></li><li class="chapter-item "><a href="../../posts/rust/parse_types.html"><strong aria-hidden="true">9.4.</strong> rust types</a></li><li class="chapter-item "><a href="../../posts/rust/rust_life_cycle.html"><strong aria-hidden="true">9.5.</strong> Rust life cycle</a></li><li class="chapter-item "><a href="../../posts/rust/rust_generic.html"><strong aria-hidden="true">9.6.</strong> rust generics</a></li><li class="chapter-item "><a href="../../posts/rust/rust_implment_matrix.html"><strong aria-hidden="true">9.7.</strong> Rust implement matrix</a></li><li class="chapter-item "><a href="../../posts/rust/rust_sort.html"><strong aria-hidden="true">9.8.</strong> Rust implement sort algorithms</a></li><li class="chapter-item "><a href="../../posts/rust/implement_aes_encryption.html"><strong aria-hidden="true">9.9.</strong> Rust implement AEC encryption and decryption</a></li><li class="chapter-item "><a href="../../posts/rust/implement_trie_data_structure.html"><strong aria-hidden="true">9.10.</strong> implement trie data structure</a></li><li class="chapter-item "><a href="../../posts/rust/rust_implement_tree.html"><strong aria-hidden="true">9.11.</strong> implement tree data_structure</a></li><li class="chapter-item "><a href="../../posts/rust/list_dir.html"><strong aria-hidden="true">9.12.</strong> list dir</a></li><li class="chapter-item "><a href="../../posts/rust/fast_way_to_implment_object_trait.html"><strong aria-hidden="true">9.13.</strong> fast way to implment object trait</a></li><li class="chapter-item "><a href="../../posts/rust/compress_rust_binary_size.html"><strong aria-hidden="true">9.14.</strong> compress rust binary size</a></li><li class="chapter-item "><a href="../../posts/rust/implment_file_upload_backend.html"><strong aria-hidden="true">9.15.</strong> impliment file upload</a></li><li class="chapter-item "><a href="../../posts/rust/this_is_add_post_cli_implementation_in_rust.html"><strong aria-hidden="true">9.16.</strong> this is add_post cli implementation in rust</a></li><li class="chapter-item "><a href="../../posts/rust/use_rust_implment_a_copyclipbord_cli.html"><strong aria-hidden="true">9.17.</strong> Use rust implment a copyclipbord CLI</a></li><li class="chapter-item "><a href="../../posts/rust/sqlite_database_add_delete_update_show_in_rust.html"><strong aria-hidden="true">9.18.</strong> sqlite database add delete update show in rust</a></li><li class="chapter-item "><a href="../../posts/rust/implementing_tokio_joinhandle_for_wasm.html"><strong aria-hidden="true">9.19.</strong> Implementing tokio JoinHandle for wasm</a></li><li class="chapter-item "><a href="../../posts/rust/rust_implement_a_crate_for_encode_and_decode_brainfuck_and_ook.html"><strong aria-hidden="true">9.20.</strong> rust implement a crate for encode and decode brainfuck and ook</a></li><li class="chapter-item "><a href="../../posts/rust/slint_builtin_elements.html"><strong aria-hidden="true">9.21.</strong> Slint Builtin Elements</a></li><li class="chapter-item "><a href="../../posts/rust/corporate_network_install_rust_on_windows.html"><strong aria-hidden="true">9.22.</strong> Corporate network install Rust on windows</a></li><li class="chapter-item "><a href="../../posts/rust/rust_binary_file_how_to_judge_static_link_or_dynamic_link_in_macos.html"><strong aria-hidden="true">9.23.</strong> rust binary file how to judge static link or dynamic link in Macos</a></li><li class="chapter-item "><a href="../../posts/rust/rust_binary_include_dir_and_get_contents.html"><strong aria-hidden="true">9.24.</strong> rust binary include dir and get contents</a></li><li class="chapter-item "><a href="../../posts/rust/how_to_create_yolov8_based_object_detection_web_service_using_python,_julia,_node.js,_javascript,_go_and_rust.html"><strong aria-hidden="true">9.25.</strong> How to create YOLOv8-based object detection web service using Python, Julia, Node.js, JavaScript, Go and Rust</a></li><li class="chapter-item "><a href="../../posts/rust/implment_builder_proc_macro_for_command_struct.html"><strong aria-hidden="true">9.26.</strong> implment Builder proc-macro for Command struct</a></li></ol></li><li class="chapter-item "><a href="../../posts/java/java.html"><strong aria-hidden="true">10.</strong> Java</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/java/java_grammar.html"><strong aria-hidden="true">10.1.</strong> java grammar and codewar</a></li><li class="chapter-item "><a href="../../posts/java/run_jar.html"><strong aria-hidden="true">10.2.</strong> java run .jar</a></li><li class="chapter-item "><a href="../../posts/java/java_pomxml_add_defaultgoal_to_build.html"><strong aria-hidden="true">10.3.</strong> Java pomxml add defaultGoal to build</a></li><li class="chapter-item "><a href="../../posts/java/java_set_mvn_mirror.html"><strong aria-hidden="true">10.4.</strong> Java set mvn mirror</a></li></ol></li><li class="chapter-item "><a href="../../posts/python/python.html"><strong aria-hidden="true">11.</strong> Python</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/python/convert_pesn.html"><strong aria-hidden="true">11.1.</strong> convert pesn</a></li><li class="chapter-item "><a href="../../posts/python/find_remove_dir.html"><strong aria-hidden="true">11.2.</strong> find and remove dir</a></li><li class="chapter-item "><a href="../../posts/python/timing_message.html"><strong aria-hidden="true">11.3.</strong> wechat send message</a></li><li class="chapter-item "><a href="../../posts/python/use_python_openpyxl_package_read_and_edit_excel_files.html"><strong aria-hidden="true">11.4.</strong> Use python openpyxl package read and edit excel files</a></li><li class="chapter-item "><a href="../../posts/python/sanctum_model_yaml.html"><strong aria-hidden="true">11.5.</strong> sanctum model yaml</a></li><li class="chapter-item "><a href="../../posts/python/how_to_detect_objects_on_images_using_the_yolov8_neural_network.html"><strong aria-hidden="true">11.6.</strong> How to detect objects on images using the YOLOv8 neural network</a></li><li class="chapter-item "><a href="../../posts/python/use_huggingface_model.html"><strong aria-hidden="true">11.7.</strong> use huggingface model</a></li></ol></li><li class="chapter-item "><a href="../../posts/go/go.html"><strong aria-hidden="true">12.</strong> Go</a></li><li class="chapter-item "><a href="../../posts/javascript/js.html"><strong aria-hidden="true">13.</strong> Javascript</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/javascript/js_tutorial.html"><strong aria-hidden="true">13.1.</strong> js tutorial</a></li><li class="chapter-item "><a href="../../posts/javascript/js_tutorial_map.html"><strong aria-hidden="true">13.2.</strong> ja map</a></li><li class="chapter-item "><a href="../../posts/javascript/js_tutorial_math.html"><strong aria-hidden="true">13.3.</strong> js math</a></li><li class="chapter-item "><a href="../../posts/javascript/js_tutorial_object.html"><strong aria-hidden="true">13.4.</strong> js object</a></li><li class="chapter-item "><a href="../../posts/javascript/js_tutorial_set.html"><strong aria-hidden="true">13.5.</strong> js set</a></li><li class="chapter-item "><a href="../../posts/javascript/single_thread_and_asynchronous.html"><strong aria-hidden="true">13.6.</strong> single thread and asynchronous</a></li><li class="chapter-item "><a href="../../posts/javascript/this.html"><strong aria-hidden="true">13.7.</strong> js this</a></li><li class="chapter-item "><a href="../../posts/javascript/js_implment_aes.html"><strong aria-hidden="true">13.8.</strong> js implment aes</a></li><li class="chapter-item "><a href="../../posts/javascript/getting_started_with_ajax.html"><strong aria-hidden="true">13.9.</strong> getting started with ajax</a></li><li class="chapter-item "><a href="../../posts/javascript/BinarySearchTree.html"><strong aria-hidden="true">13.10.</strong> binary search tree</a></li><li class="chapter-item "><a href="../../posts/javascript/goole_zx.html"><strong aria-hidden="true">13.11.</strong> goole zx</a></li><li class="chapter-item "><a href="../../posts/javascript/es6.html"><strong aria-hidden="true">13.12.</strong> es6</a></li></ol></li><li class="chapter-item "><a href="../../posts/ruby/ruby.html"><strong aria-hidden="true">14.</strong> Ruby</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/ruby/rails_setup_env.html"><strong aria-hidden="true">14.1.</strong> ruby on rails setup environment</a></li><li class="chapter-item "><a href="../../posts/ruby/learn_ruby.html"><strong aria-hidden="true">14.2.</strong> learn ruby</a></li><li class="chapter-item "><a href="../../posts/ruby/ruby_note.html"><strong aria-hidden="true">14.3.</strong> Ruby Note</a></li><li class="chapter-item "><a href="../../posts/ruby/setup_ruby_for_ctf.html"><strong aria-hidden="true">14.4.</strong> Setup ruby for CTF</a></li></ol></li><li class="chapter-item "><a href="../../posts/react/react.html"><strong aria-hidden="true">15.</strong> React</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/react/react_life_cycle.html"><strong aria-hidden="true">15.1.</strong> react life cycle</a></li><li class="chapter-item "><a href="../../posts/react/react_router.html"><strong aria-hidden="true">15.2.</strong> react router</a></li><li class="chapter-item "><a href="../../posts/react/react_this.html"><strong aria-hidden="true">15.3.</strong> react this</a></li><li class="chapter-item "><a href="../../posts/react/react_interviw.html"><strong aria-hidden="true">15.4.</strong> react interview</a></li><li class="chapter-item "><a href="../../posts/react/important_react_interview.html"><strong aria-hidden="true">15.5.</strong> important react interview</a></li><li class="chapter-item "><a href="../../posts/react/react_quick_reference.html"><strong aria-hidden="true">15.6.</strong> react quick reference</a></li><li class="chapter-item "><a href="../../posts/react/redux_quick_reference.html"><strong aria-hidden="true">15.7.</strong> redux quick reference</a></li></ol></li><li class="chapter-item "><a href="../../posts/vue/vue.html"><strong aria-hidden="true">16.</strong> Vue</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/vue/vue_ajax.html"><strong aria-hidden="true">16.1.</strong> vue ajax</a></li></ol></li><li class="chapter-item "><a href="../../posts/angular/angular.html"><strong aria-hidden="true">17.</strong> Angular</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/angular/controller_communication.html"><strong aria-hidden="true">17.1.</strong> controller communication</a></li><li class="chapter-item "><a href="../../posts/angular/creating_custom_directives.html"><strong aria-hidden="true">17.2.</strong> creating custom directives</a></li><li class="chapter-item "><a href="../../posts/angular/directive_notes.html"><strong aria-hidden="true">17.3.</strong> directive notes</a></li><li class="chapter-item "><a href="../../posts/angular/directive_communication.html"><strong aria-hidden="true">17.4.</strong> directive communication</a></li><li class="chapter-item "><a href="../../posts/angular/post_params.html"><strong aria-hidden="true">17.5.</strong> post params</a></li><li class="chapter-item "><a href="../../posts/angular/read_json_angular.html"><strong aria-hidden="true">17.6.</strong> read json angular</a></li><li class="chapter-item "><a href="../../posts/angular/same_route_reload.html"><strong aria-hidden="true">17.7.</strong> same route reload</a></li></ol></li><li class="chapter-item "><a href="../../posts/css/css.html"><strong aria-hidden="true">18.</strong> Css</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/css/use_css_media.html"><strong aria-hidden="true">18.1.</strong> use css media</a></li></ol></li><li class="chapter-item "><a href="../../posts/php/php.html"><strong aria-hidden="true">19.</strong> Php</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/php/for_php_string_implment_some_extemtion_functions.html"><strong aria-hidden="true">19.1.</strong> for php string implment some extemtion functions</a></li><li class="chapter-item "><a href="../../posts/php/php_cheatsheet.html"><strong aria-hidden="true">19.2.</strong> PHP cheatsheet</a></li></ol></li><li class="chapter-item "><a href="../../posts/leetcode/leetcode.html"><strong aria-hidden="true">20.</strong> Leetcode</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/leetcode/rust_leetcode.html"><strong aria-hidden="true">20.1.</strong> rust leetcode</a></li><li class="chapter-item "><a href="../../posts/leetcode/rust_codewar.html"><strong aria-hidden="true">20.2.</strong> rust codewar</a></li><li class="chapter-item "><a href="../../posts/leetcode/swift_codewar.html"><strong aria-hidden="true">20.3.</strong> swift codewar</a></li><li class="chapter-item "><a href="../../posts/leetcode/js_leetcode.html"><strong aria-hidden="true">20.4.</strong> js leetcode</a></li><li class="chapter-item "><a href="../../posts/leetcode/java_leetcode.html"><strong aria-hidden="true">20.5.</strong> java leetcode</a></li><li class="chapter-item "><a href="../../posts/leetcode/rust_huawei.html"><strong aria-hidden="true">20.6.</strong> huawei test</a></li><li class="chapter-item "><a href="../../posts/leetcode/rust_utils.html"><strong aria-hidden="true">20.7.</strong> rust common functions</a></li><li class="chapter-item "><a href="../../posts/leetcode/olympiad_training.html"><strong aria-hidden="true">20.8.</strong> Computer olympiad training</a></li></ol></li><li class="chapter-item "><a href="../../posts/ctf/CTF.html"><strong aria-hidden="true">21.</strong> CTF</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/ctf/CTF_Note.html"><strong aria-hidden="true">21.1.</strong> CTF Note</a></li><li class="chapter-item "><a href="../../posts/ctf/0.1_Web.html"><strong aria-hidden="true">21.2.</strong> Web</a></li><li class="chapter-item "><a href="../../posts/ctf/4.1_Misc.html"><strong aria-hidden="true">21.3.</strong> Misc</a></li><li class="chapter-item "><a href="../../posts/ctf/3.2_PWN_note.html"><strong aria-hidden="true">21.4.</strong> PWN</a></li><li class="chapter-item "><a href="../../posts/ctf/3.1_Crypto.html"><strong aria-hidden="true">21.5.</strong> Crypto</a></li><li class="chapter-item "><a href="../../posts/ctf/3.4_RSA_note.html"><strong aria-hidden="true">21.6.</strong> Rsa attack</a></li><li class="chapter-item "><a href="../../posts/ctf/3.5_Base64.html"><strong aria-hidden="true">21.7.</strong> Base64</a></li><li class="chapter-item "><a href="../../posts/ctf/0.0_SQL Injection Cheatsheet.html"><strong aria-hidden="true">21.8.</strong> SQL Injection Cheatsheet</a></li><li class="chapter-item "><a href="../../posts/ctf/1.1_SQL_injection.html"><strong aria-hidden="true">21.9.</strong> SQL Injection</a></li><li class="chapter-item "><a href="../../posts/ctf/1.2_SQL_injection_UNION_attacks.html"><strong aria-hidden="true">21.10.</strong> SQL Injection UNION attacks</a></li><li class="chapter-item "><a href="../../posts/ctf/1.3_Blind SQL injection.html"><strong aria-hidden="true">21.11.</strong> Blind SQL Injection</a></li><li class="chapter-item "><a href="../../posts/ctf/1.4_Code Injection.html"><strong aria-hidden="true">21.12.</strong> Code Injection</a></li><li class="chapter-item "><a href="../../posts/ctf/1.5_SSRF.html"><strong aria-hidden="true">21.13.</strong> SSRF</a></li><li class="chapter-item "><a href="../../posts/ctf/1.6_OS command injection.html"><strong aria-hidden="true">21.14.</strong> OS command injection</a></li><li class="chapter-item "><a href="../../posts/ctf/1.7_Local file inclusion.html"><strong aria-hidden="true">21.15.</strong> Local file inclusion</a></li><li class="chapter-item "><a href="../../posts/ctf/1.8_Remote file inclusion.html"><strong aria-hidden="true">21.16.</strong> Remote file inclusion</a></li><li class="chapter-item "><a href="../../posts/ctf/1.9_CSRFm.html"><strong aria-hidden="true">21.17.</strong> CSRF</a></li><li class="chapter-item "><a href="../../posts/ctf/1.10_NoSQL injection.html"><strong aria-hidden="true">21.18.</strong> NoSQL injection</a></li><li class="chapter-item "><a href="../../posts/ctf/1.11_JSON injection.html"><strong aria-hidden="true">21.19.</strong> JSON injection</a></li><li class="chapter-item "><a href="../../posts/ctf/1.12_CTF_Web_SQL_Note.html"><strong aria-hidden="true">21.20.</strong> CTF Web SQL Note</a></li><li class="chapter-item "><a href="../../posts/ctf/2.1_XXE.html"><strong aria-hidden="true">21.21.</strong> XXE</a></li><li class="chapter-item "><a href="../../posts/ctf/2.2_XSS.html"><strong aria-hidden="true">21.22.</strong> XSS</a></li><li class="chapter-item "><a href="../../posts/ctf/2.3_Upload File.html"><strong aria-hidden="true">21.23.</strong> Upload File</a></li><li class="chapter-item "><a href="../../posts/ctf/2.4_serialize_unserialize.html"><strong aria-hidden="true">21.24.</strong> serialize unserialize</a></li><li class="chapter-item "><a href="../../posts/ctf/2.5_Race condition.html"><strong aria-hidden="true">21.25.</strong> Race condition</a></li><li class="chapter-item "><a href="../../posts/ctf/zip_plain_text_attack.html"><strong aria-hidden="true">21.26.</strong> Zip plain text attack</a></li><li class="chapter-item "><a href="../../posts/ctf/3.3_pwn HCTF2016 brop.html"><strong aria-hidden="true">21.27.</strong> pwn HCTF2016 brop</a></li><li class="chapter-item "><a href="../../posts/ctf/pwn_patch_defense_skill.html"><strong aria-hidden="true">21.28.</strong> PWN Patch defense skill</a></li><li class="chapter-item "><a href="../../posts/ctf/pwn_stack_overflow.html"><strong aria-hidden="true">21.29.</strong> PWN stack overflow</a></li><li class="chapter-item "><a href="../../posts/ctf/pwn_heap_overflow.html"><strong aria-hidden="true">21.30.</strong> PWN heap overflow</a></li><li class="chapter-item "><a href="../../posts/ctf/pwn_format_string_vulnerability.html"><strong aria-hidden="true">21.31.</strong> PWN Format String Vulnerability</a></li><li class="chapter-item "><a href="../../posts/ctf/kali_linux_tutorials.html"><strong aria-hidden="true">21.32.</strong> Kali linux tutorials</a></li><li class="chapter-item "><a href="../../posts/ctf/google_dorks_2023_lists.html"><strong aria-hidden="true">21.33.</strong> Google Dorks 2023 Lists</a></li><li class="chapter-item "><a href="../../posts/ctf/dvwa_writeup.html"><strong aria-hidden="true">21.34.</strong> DVWA WriteUp</a></li><li class="chapter-item "><a href="../../posts/ctf/bwapp_writeup.html"><strong aria-hidden="true">21.35.</strong> bWAPP WriteUp</a></li><li class="chapter-item "><a href="../../posts/ctf/sqlilabs_writeup.html"><strong aria-hidden="true">21.36.</strong> sqlilabs WriteUp</a></li><li class="chapter-item "><a href="../../posts/ctf/pwnable_kr_challenge.html"><strong aria-hidden="true">21.37.</strong> Solutions for pwnable.kr</a></li><li class="chapter-item "><a href="../../posts/ctf/the_periodic_table.html"><strong aria-hidden="true">21.38.</strong> The Periodic Table</a></li><li class="chapter-item "><a href="../../posts/ctf/pwntools_cheatsheet.html"><strong aria-hidden="true">21.39.</strong> Pwntools Cheatsheet</a></li><li class="chapter-item "><a href="../../posts/ctf/gdb_cheatsheet.html"><strong aria-hidden="true">21.40.</strong> GDB Cheatsheet</a></li></ol></li><li class="chapter-item "><a href="../../posts/iltes/iltes.html"><strong aria-hidden="true">22.</strong> ILTES</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../../posts/iltes/iltes_writing.html"><strong aria-hidden="true">22.1.</strong> ILTES Writing</a></li></ol></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
<!-- Track and set sidebar scroll position -->
<script>
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
sidebarScrollbox.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
sidebarScrollbox.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
</script>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</button>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Andrew&#x27;s Blog</h1>
<div class="right-buttons">
<a href="https://gitee.com/dnrops/dnrops" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h2 id="c-introduction"><a class="header" href="#c-introduction"><strong>C# Introduction</strong></a></h2>
<ul>
<li>Object-oriented language, with syntax similar to C++ and Java.</li>
<li>Type safe</li>
<li>Component oriented, structured language</li>
<li>Automatic garbage collection</li>
<li>Rich set of libraries</li>
<li>Conditional compilation</li>
</ul>
<h3 id="syntax"><a class="header" href="#syntax"><strong>Syntax</strong></a></h3>
<ul>
<li>Case sensitive</li>
<li>Comments are typed within // (single-line) or /**/ (multi-line)</li>
<li>Code is typed inside code blocks {}</li>
<li>Line termination is done using semicolon ;</li>
<li>Supports comment task highlighters like TODO: , NOTE: , WARN: etc…</li>
</ul>
<h3 id="variables"><a class="header" href="#variables"><strong>Variables</strong></a></h3>
<p><code>&lt;datatype&gt; &lt;variablename&gt; = &lt;initialvalue&gt;;</code></p>
<ul>
<li>Variables should start with underscore and cannot contain white spaces.</li>
<li>It can contain numbers but should always start with a capital letter.</li>
<li>It cannot contain any symbols (other than underscore).</li>
</ul>
<h3 id="naming-conventions"><a class="header" href="#naming-conventions"><strong>Naming Conventions</strong></a></h3>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td>Class</td><td><strong>S</strong>tudent<strong>C</strong>lass</td></tr>
<tr><td>Method</td><td><strong>G</strong>et<strong>M</strong>arks</td></tr>
<tr><td>Local variable</td><td><strong>f</strong>irst<strong>N</strong>ame</td></tr>
<tr><td>Private variable</td><td><strong>a</strong>vg<strong>M</strong>arks</td></tr>
<tr><td>Constant</td><td><strong>P</strong>ercentile</td></tr>
</tbody></table>
</div>
<h3 id="data-types"><a class="header" href="#data-types"><strong>Data types</strong></a></h3>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td>Int</td><td>Integer values like 1234, 10000</td></tr>
<tr><td>Double</td><td>64-bit floating-point, 3.145644</td></tr>
<tr><td>Float</td><td>Floating point number, 3.1454</td></tr>
<tr><td>String</td><td>Set of characters, “Welcome.”</td></tr>
<tr><td>Byte</td><td>8bit unsigned integer</td></tr>
<tr><td>Char</td><td>16 bit Unicode character, A.</td></tr>
<tr><td>Long</td><td>64 bit signed integer, -9.0789</td></tr>
<tr><td>Decimal</td><td>High precision decimal numbers</td></tr>
<tr><td>Bool</td><td>True or false Boolean value</td></tr>
<tr><td>Enums</td><td>Value data type contains its value</td></tr>
<tr><td>Struct</td><td>value type that is used to represent a record</td></tr>
</tbody></table>
</div>
<p><strong>Initialisation of variables</strong></p>
<pre><code>int i = 7;
byte b = 255;
String s = “hackr.io”;
char c = h;
</code></pre>
<p><strong>Constant values</strong></p>
<pre><code>const String lastDayOfWeek = “Friday”;
</code></pre>
<h3 id="string-data-type-conversion"><a class="header" href="#string-data-type-conversion"><strong>String Data type conversion</strong></a></h3>
<div class="table-wrapper"><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody>
<tr><td><strong>Method</strong></td><td><strong>Description</strong></td><td><strong>Example</strong></td></tr>
<tr><td>AsInt(), IsInt()</td><td>Convert string into integerCheck If the input is int</td><td>intVal = str.AsInt();str.IsInt()</td></tr>
<tr><td>AsFloat(),IsFloat()</td><td>Convert string into floatCheck if the input is float</td><td>floatVal = str.AsFloat();str.IsFloat()</td></tr>
<tr><td>AsDecimal()IsDecimal()</td><td>Convert string into decimalCheck if input is decimal</td><td>decVal = str.AsDecimal();str.IsDecimal()</td></tr>
<tr><td>AsDateTime()IsDateTime()</td><td>Convert string into datetime typeCheck if input is date-time</td><td>dateVal = str.AsDateTime(); str.isDateTime();</td></tr>
<tr><td>AsBool() IsBool()</td><td>Convert string into BooleanCheck if input is Boolean</td><td>boolVal = str.AsBool();str.IsBool();</td></tr>
<tr><td>ToString()</td><td>Convert another data type like int, array, list etc into String</td><td>myVal = 1111;strVal = myVal.ToString();</td></tr>
</tbody></table>
</div>
<h3 id="operators"><a class="header" href="#operators"><strong>Operators</strong></a></h3>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td><strong>Operator</strong></td><td><strong>Description</strong></td></tr>
<tr><td>=</td><td>Assigns variable value. (i = 10)</td></tr>
<tr><td>+</td><td>Adds a value or variable. (i + j) or (i + 3)</td></tr>
<tr><td>-</td><td>Subtracts values or variables. (i j)</td></tr>
<tr><td>*</td><td>Multiplies values or variables. (i*j)</td></tr>
<tr><td>/</td><td>Divides values or variables. (i/j)</td></tr>
<tr><td>+=</td><td>Increments a variable. ( i+=1)</td></tr>
<tr><td>-=</td><td>Decrements a variable. (i-=1)</td></tr>
<tr><td>==</td><td>Equality. Returns true if values are equal. (i==10)</td></tr>
<tr><td>!=</td><td>Inequality. Returns true if values are not equal. (I != 10)</td></tr>
<tr><td>&lt;</td><td>Less Than (i &lt; 5)</td></tr>
<tr><td>&gt;</td><td>Greater Than (i &gt; 5)</td></tr>
<tr><td>&lt;=</td><td>Less Than or Equal to (i &lt;= 5)</td></tr>
<tr><td>&gt;=</td><td>Greater than equal to (i &gt;= 5)</td></tr>
<tr><td>+</td><td>String concatenation (“Welcome to ” + websiteName)</td></tr>
<tr><td>.</td><td>Call methods, constant variables etc..arrVal.ToString()</td></tr>
<tr><td>()</td><td>Calculations, passing parameters etc…(i+10)*(i-10); multiply(i, j)</td></tr>
<tr><td>[]</td><td>Access values in arrays or collections. name[i]</td></tr>
<tr><td>!</td><td>Reversing Boolean valueif (!isMatching)</td></tr>
<tr><td>&amp;&amp;</td><td>Logical ANDif (isSingle &amp;&amp; isMatching)</td></tr>
<tr><td>sizeof()</td><td>returns the size of a data type</td></tr>
<tr><td>typeof()</td><td>returns the type of object string, integer etc…</td></tr>
</tbody></table>
</div>
<h3 id="string-operations"><a class="header" href="#string-operations"><strong>String Operations</strong></a></h3>
<div class="table-wrapper"><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody>
<tr><td><strong>String Functions</strong></td><td><strong>Definitions</strong></td><td><strong>Example</strong></td></tr>
<tr><td>Clone()</td><td>Make clone of string.</td><td>str2 = str1.Clone()</td></tr>
<tr><td>CompareTo()</td><td>Compare two strings and returns integer value as output. It returns 0 for true and 1 for false.</td><td>str2.CompareTo(str1)</td></tr>
<tr><td>Contains()</td><td>checks whether specified character or string is exists or not in the string value.</td><td>str2.Contains(“hack”);</td></tr>
<tr><td>EndsWith()</td><td>checks whether specified character is the last character of string or not.</td><td>str2.EndsWith(“io”);</td></tr>
<tr><td>Equals()</td><td>compares two string and returns Boolean value true as output if they are equal, false if not</td><td>str2.Equals(str1)</td></tr>
<tr><td>GetHashCode()</td><td>returns HashValue of specified string.</td><td>str1.GetHashCode()</td></tr>
<tr><td>GetType()</td><td>returns the System.Type of current instance.</td><td>str1.GetType()</td></tr>
<tr><td>GetTypeCode()</td><td>returns the Stystem.TypeCode for class System.String.</td><td>str1.GetTypeCode()</td></tr>
<tr><td>IndexOf()</td><td>Returns the index position of first occurrence of specified character.</td><td>str1.IndexOf(“:”)</td></tr>
<tr><td>ToLower()</td><td>Converts String into lower case based on rules of the current culture.</td><td>str1.ToLower();</td></tr>
<tr><td>ToUpper()</td><td>Converts String into Upper case based on rules of the current culture.</td><td>str1.ToUpper();</td></tr>
<tr><td>Insert()</td><td>Insert the string or character in the string at the specified position.</td><td>str1.Insert(0, “Welcome”);str1.Insert(i, “Thank You”);</td></tr>
<tr><td>IsNormalized()</td><td>Check whether this string is in Unicode normalization form</td><td>str1.IsNormalized()</td></tr>
<tr><td>LastIndexOf()</td><td>Returns the index position of last occurrence of specified character.</td><td>str1.LastIndexOf(“T”);</td></tr>
<tr><td>Length</td><td>returns length of string.</td><td>str1.Length;</td></tr>
<tr><td>Remove()</td><td>deletes all the characters from beginning to specified index position.</td><td>str1.Remove(i);</td></tr>
<tr><td>Replace()</td><td>replaces the specified character with another</td><td>str1.Replace(a, e);</td></tr>
<tr><td>Split()</td><td>This method splits the string based on specified value.</td><td>str1 = “Good morning and Welcome”;String sep = {“and”};strArray = str1.Split(sep, StringSplitOptions.None);</td></tr>
<tr><td>StartsWith()</td><td>Checks whether the first character of string is same as specified character.</td><td>str1.StartsWith(“H”)</td></tr>
<tr><td>Substring()</td><td>This method returns substring.</td><td>str1.Substring(1, 7);</td></tr>
<tr><td>ToCharArray()</td><td>Converts string into char array.</td><td>str1.ToCharArray()</td></tr>
<tr><td>Trim()</td><td>It removes extra whitespaces from beginning and ending of string.</td><td>str1.Trim();</td></tr>
</tbody></table>
</div>
<h3 id="modifiers"><a class="header" href="#modifiers"><strong>Modifiers</strong></a></h3>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td>public</td><td>field or function accessible by any other code in the same assembly or another assembly that references it</td></tr>
<tr><td>private</td><td>Only available by code in the same class or struct</td></tr>
<tr><td>protected</td><td>Only accessible by code in the same class or struct or a derived class</td></tr>
<tr><td>internal</td><td>Accessible by any code in the same assembly, but not from another assembly</td></tr>
<tr><td>protected internal</td><td>Accessible by any code in the same assembly, or by any derived class in another assembly</td></tr>
<tr><td>abstract</td><td>to indicate a class that is intended only to be a base class of other classes (has to be extended by other classes)</td></tr>
<tr><td>async</td><td>Indicates that the modified method, lambda expression, or anonymous method is asynchronous</td></tr>
<tr><td>const</td><td>Specifies that the value of the field or the local variable cannot be modified (constant)</td></tr>
<tr><td>event</td><td>Declares an event</td></tr>
<tr><td>extern</td><td>Indicates that the method is implemented externally</td></tr>
<tr><td>new</td><td>Explicitly hides a member inherited from a base class</td></tr>
<tr><td>override</td><td>Provides a new implementation of a virtual member inherited from a base class</td></tr>
<tr><td>partial</td><td>Defines partial classes, structs, and methods throughout the same assembly</td></tr>
<tr><td>read-only</td><td>Declares a field that can only be assigned values as part of the declaration or in a constructor in the same class</td></tr>
<tr><td>sealed</td><td>Specifies that a class cannot be inherited</td></tr>
<tr><td>static</td><td>Declares a member that belongs to the type itself instead of to a specific object, e.g., for static class or method, no object needs to be created</td></tr>
<tr><td>unsafe</td><td>Declares an unsafe context</td></tr>
<tr><td>virtual</td><td>Declares a method or an accessor whose implementation can be changed by an overriding member in a derived class</td></tr>
<tr><td>volatile</td><td>Indicates that a field can be modified in the program by something such as the operating system, the hardware, or a concurrently executing thread</td></tr>
</tbody></table>
</div>
<h3 id="datetime-formatting"><a class="header" href="#datetime-formatting"><strong>Date/Time formatting</strong></a></h3>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td>DateTime dt = new DateTime();dt.ToString();</td><td>gives output as 01-01-0001 00:00:00</td></tr>
<tr><td>dt = DateTime.Now;</td><td>gives current date and time</td></tr>
<tr><td>dt = new DateTime(yyyy, MM, dd);</td><td>gives the specified date in yyyy-MM-dd format. Time will be 00:00:00</td></tr>
<tr><td>dt = new DateTime(yyyy, MM, dd, hh, min, ss);</td><td>gives specified date and time in the 24-hour format</td></tr>
<tr><td>dt = new DateTime(yyyy, MM, dd, hh, mm, ss);dt1 = dt.Date;</td><td>gives only the date, with the time part set to 00:00:00</td></tr>
<tr><td>DateTime.Now.ToShortDateString()</td><td>prints only the date part by completely omitting the time part</td></tr>
<tr><td>DateTime.Now.ToLongDateString()</td><td>prints the whole date and time based on region, month is printed in letters (JAN, FEB etc.. ) rather than number (01, 02)</td></tr>
</tbody></table>
</div>
<h3 id="datetime-format-specifiers"><a class="header" href="#datetime-format-specifiers"><strong>DateTime format specifiers</strong></a></h3>
<div class="table-wrapper"><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody>
<tr><td><strong>Format specifier</strong></td><td><strong>Name</strong></td><td><strong>Description</strong></td></tr>
<tr><td>d</td><td>Short date pattern</td><td>Represents a custom <strong>DateTime</strong> format string defined by the current <a href="https://msdn.microsoft.com/en-us/library/151kkadx(v=vs.85)">ShortDatePattern</a> property.For example, the custom format string for the invariant culture is “MM/dd/yyyy.”</td></tr>
<tr><td>D</td><td>Long date pattern</td><td>Represents a custom <strong>DateTime</strong> format string defined by the current <a href="https://msdn.microsoft.com/en-us/library/e911xxw2(v=vs.85)">LongDatePattern</a> property.For example, the custom format string for the invariant culture is “dddd, dd MMMM yyyy.”</td></tr>
<tr><td>f</td><td>Full date/time pattern (short time)</td><td>Represents a combination of the long date (D) and short time (t) patterns, separated by a space.</td></tr>
<tr><td>F</td><td>Full date/time pattern (long time)</td><td>Represents a custom <strong>DateTime</strong> format string defined by the current <a href="https://msdn.microsoft.com/en-us/library/s01142hb(v=vs.85)">FullDateTimePattern</a> property.For example, the custom format string for the invariant culture is “dddd, dd MMMM yyyy HH:mm: ss.”</td></tr>
<tr><td>g</td><td>General date/time pattern (short time)</td><td>Represents a combination of the short date (d) and short time (t) patterns, separated by a space.</td></tr>
<tr><td>G</td><td>General date/time pattern (long time)</td><td>Represents a combination of the short date (d) and long time (T) patterns, separated by a space.</td></tr>
<tr><td>M or m</td><td>Month day pattern</td><td>Represents a custom <strong>DateTime</strong> format string defined by the current <a href="https://msdn.microsoft.com/en-us/library/6s54hbfa(v=vs.85)">MonthDayPattern</a> property.For example, the custom format string for the invariant culture is “MMMM dd.”</td></tr>
<tr><td>o</td><td>Round-trip date/time pattern</td><td>Represents a custom <strong>DateTime</strong> format string using a pattern that preserves time zone information. The pattern is designed to round-trip <strong>DateTime</strong> formats, including the <strong>Kind</strong> property, in text. Then the formatted string can be parsed back using <a href="https://msdn.microsoft.com/en-us/library/1k1skd40(v=vs.85)">Parse</a> or <a href="https://msdn.microsoft.com/en-us/library/w2sa9yss(v=vs.85)">ParseExact</a> with the correct <strong>Kind</strong> property value.The custom format string is “yyyy-MM-ddTHH: mm: ss.fffffffK.“The pattern for this specifier is a defined standard. Therefore, it is always the same, regardless of the culture used or the format provider supplied.</td></tr>
<tr><td>R or r</td><td>RFC1123 pattern</td><td>Represents a custom <strong>DateTime</strong> format string defined by the current <a href="https://msdn.microsoft.com/en-us/library/d632bk6h(v=vs.85)">RFC1123Pattern</a> property. The pattern is a defined standard, and the property is read-only. Therefore, it is always the same regardless of the culture used, or the format provider supplied.The custom format string is “DDD, dd MMM yyyy HH: mm: ss GMT”.Formatting does not modify the value of the <strong>DateTime</strong> object that is being formatted. Therefore, the application must convert the value to Coordinated Universal Time (UTC) before using this format specifier.</td></tr>
<tr><td>s</td><td>Sortable date/time pattern; conforms to ISO 8601</td><td>Represents a custom <strong>DateTime</strong> format string defined by the current <a href="https://msdn.microsoft.com/en-us/library/tw6x7xba(v=vs.85)">SortableDateTimePattern</a> property. This pattern is a defined standard, and the property is read-only. Therefore, it is always the same regardless of the culture used, or the format provider supplied.The custom format string is “yyyy-MM-ddTHH:mm: ss.”</td></tr>
<tr><td>t</td><td>Short time pattern</td><td>Represents a custom <strong>DateTime</strong> format string defined by the current <a href="https://msdn.microsoft.com/en-us/library/19985y27(v=vs.85)">ShortTimePattern</a> property.For example, the custom format string for the invariant culture is “HH:mm.”</td></tr>
<tr><td>T</td><td>Long time pattern</td><td>Represents a custom <strong>DateTime</strong> format string defined by the current <a href="https://msdn.microsoft.com/en-us/library/4zwd57t4(v=vs.85)">LongTimePattern</a> property.For example, the custom format string for the invariant culture is “HH:mm: ss”.</td></tr>
<tr><td>u</td><td>Universal sortable date/time pattern</td><td>Represents a custom <strong>DateTime</strong> format string defined by the current <a href="https://msdn.microsoft.com/en-us/library/84bb9x8h(v=vs.85)">UniversalSortableDateTimePattern</a> property. This pattern is a defined standard and the property is read-only. Therefore, it is always the same regardless of the culture used or the format provider supplied.The custom format string is “yyyy-MM-dd HH:mm:ssZ”.No time zone conversion is done when the date and time is formatted. Therefore, the application must convert a local date and time to Coordinated Universal Time (UTC) before using this format specifier.</td></tr>
<tr><td>U</td><td>Universal sortable date/time pattern</td><td>Represents a custom <strong>DateTime</strong> format string defined by the current <strong>FullDateTimePattern</strong> property.This pattern is the same as the full date/long time (F) pattern. However, formatting operates on the Coordinated Universal Time (UTC) that is equivalent to the <strong>DateTime</strong> object being formatted.</td></tr>
<tr><td>Y or y</td><td>Year month pattern</td><td>Represents a custom <strong>DateTime</strong> format string defined by the current <a href="https://msdn.microsoft.com/en-us/library/kfxe1b67(v=vs.85)">YearMonthPattern</a> property.For example, the custom format string for the invariant culture is “yyyy MMMM”.</td></tr>
<tr><td>Custom format</td><td>Custom patterns “MM/dd yyyy”“dd.MM.yyyy”“MM.dd.yyyy HH:mm”“dddd, MMMM (yyyy): HH:mm:ss”</td><td>03/17 201917.03.201903.17.2019 06:23Tuesday, march (2019) : 06:23:00</td></tr>
<tr><td>Any other single character</td><td>(Unknown specifier)</td><td>An unknown specifier throws a runtime format exception.</td></tr>
</tbody></table>
</div>
<h3 id="arrays"><a class="header" href="#arrays"><strong>Arrays</strong></a></h3>
<p>For creating, modifying, sorting and searching arrays.</p>
<div class="table-wrapper"><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody>
<tr><td><strong>PROPERTY</strong></td><td><strong>DESCRIPTION</strong></td><td><strong>EXAMPLE</strong></td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-check-if-an-array-has-fixed-size-or-not/"><strong>IsFixedSize</strong></a></td><td>checks whether the Array has a fixed size.</td><td>string[] arrVal = new string[] {“stud1”, “stud2”, “stud3”}; arrVal.IsFixedSize;</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-check-if-an-array-is-read-only-or-not/"><strong>IsReadOnly</strong></a></td><td>Checks whether the Array is read-only.</td><td>arrVal.IsReadOnly;</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-check-if-an-array-is-synchronized-thread-safe-or-not/"><strong>IsSynchronized</strong></a></td><td>Checks whether access to the Array is synchronized (thread safe).</td><td>arrVal.IsSynchronized;</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/how-to-find-the-length-of-an-array-in-c/"><strong>Length</strong></a></td><td>Gets the total number of elements in all the dimensions of the Array.</td><td>arrVal.Length;</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-longlength-property-of-an-array/"><strong>LongLength</strong></a></td><td>Length in 64-bit integer</td><td>arrVal.LongLength;</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/how-to-find-the-rank-of-an-array-in-c/"><strong>Rank</strong></a></td><td>Gets the rank (number of dimensions) of the Array. For example, a one-dimensional array returns 1, a two-dimensional array returns 2, and so on.</td><td>arrVal.Rank;</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/how-to-get-synchronize-access-to-the-array-in-c-sharp/"><strong>SyncRoot</strong></a></td><td>Gets an object used to synchronize Array access</td><td>arrVal.SyncRoot;</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-array-asreadonlyt-method/"><strong>AsReadOnly()</strong></a></td><td>Returns a read-only wrapper for the specified array.</td><td>Array.AsReadOnly(arrVal);</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/how-to-use-array-binarysearch-method-in-c-sharp-set-1/"><strong>BinarySearch()</strong></a></td><td>Searches a value in a one-dimensional sorted array using a <a href="https://hackr.io/blog/binary-search-in-c">binary search</a> algorithm.</td><td>Array.BinarySearch(arrVal, obj); where obj is the object to be searched.</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-array-clear-method/"><strong>Clear()</strong></a></td><td>Sets a range of elements in an array to the default value of each element type.</td><td>Array.Clear(arrVal, 0, 2);If arrVal is an array of integers, the elements at position 0 to 2 will be set to zero after doing Clear().</td></tr>
<tr><td><strong>Clone()</strong></td><td>Create a shallow copy of the Array.</td><td>Array.Clone(arrVal);</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-array-constrainedcopy-method/"><strong>ConstrainedCopy()</strong></a></td><td>Copies a range of elements from an Array starting at the specified source index and pastes them to another Array starting at the specified destination index. Guarantees that all changes are undone if the copy does not succeed completely.</td><td>Array.ConstrainedCopy(srcArr, 0, destArr, 3, 5);where srcArr is the source array,0 is the start index from where copy should begin,destArr is the destination array,3 is the place where copy should start in the destination array,5 is the number of elements to copy</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-converting-an-array-of-one-type-to-an-array-of-another-type/"><strong>ConvertAll()</strong></a></td><td>Converts an array of one data type to an array of another data type.</td><td>conArr = Array.ConvertAll(arrVal, new Converter&lt;dtype1, dtype2&gt; (method));</td></tr>
<tr><td><strong>Copy()</strong></td><td>Copies a range of elements in one Array to another Array and performs type casting and boxing as required.</td><td>Array.Copy(srcArr, destArr, 2);copies first two elements from srcArr to destArr</td></tr>
<tr><td><strong>CopyTo()</strong></td><td>Copies all the elements of the current one-dimensional array to the specified one-dimensional array.</td><td>Array.CopyTo(destArr, 4);copy starts from index 4</td></tr>
<tr><td><strong>CreateInstance()</strong></td><td>Initializes a new instance of the Array class.</td><td>Array.CreateInstance(typeof(String), length);</td></tr>
<tr><td><strong>Empty()</strong></td><td>Returns an empty array.</td><td>arrVal.Empty()</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-check-if-an-array-object-is-equal-to-another-array-object/"><strong>Equals()</strong></a></td><td>Determines whether the specified object is equal to the current object.</td><td>arrVal.Equals(arrVal2);</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-check-if-an-array-contain-the-elements-that-match-the-specified-conditions/"><strong>Exists()</strong></a></td><td>Determines whether the specified array contains elements that match the conditions defined by the specified predicate.</td><td>Array.Exists(srcArr, “<elementname>”);</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-array-find-method/"><strong>Find()</strong></a></td><td>Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Array.</td><td>Array.Find(arrVal, <matching pattern>);</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-array-findall-method/"><strong>FindAll()</strong></a></td><td>Retrieves all the elements that match the conditions defined by the specified predicate.</td><td>Array.FindAll(arrVal, <matching pattern>);</td></tr>
<tr><td><strong>FindIndex()</strong></td><td>Searches for an element that matches the conditions defined by a specified predicate, and returns the zero-based index of the first occurrence within an Array or a portion of it.</td><td>Array.FindIndex(arrVal, <matching pattern>);</td></tr>
<tr><td><strong>FindLast()</strong></td><td>Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire Array.</td><td>Array.FindLast(arrVal, <matching pattern>);</td></tr>
<tr><td><strong>FindLastIndex()</strong></td><td>Searches for an element that matches the conditions defined by a specified predicate, and returns the zero-based index of the last occurrence within an Array or a portion of it.</td><td>Array.FindLastIndex(arrVal, <matching pattern>);</td></tr>
<tr><td><strong>ForEach()</strong></td><td>Loops through each element of the array and performs the specified action</td><td>Array.ForEach(arrVal, Action)</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-array-getenumerator-method/"><strong>GetEnumerator()</strong></a></td><td>Returns an IEnumerator for the Array.</td><td>arrVal.GetEnumerator()</td></tr>
<tr><td><strong>GetHashCode()</strong></td><td>default hash function.</td><td>arrVal.GetHashCode()</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-total-number-of-elements-present-in-an-array/"><strong>GetLength()</strong></a></td><td>Gets a 32-bit integer that represents the number of elements in the specified dimension of the Array.</td><td>arrVal.GetLength(i) where i is an integer</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/total-number-of-elements-in-a-specified-dimension-of-an-array-in-c/"><strong>GetLongLength()</strong></a></td><td>Gets a 64-bit integer that represents the number of elements in the specified dimension of the Array.</td><td>arrVal.GetLongLength(i) where i is an integer</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-finding-the-index-of-first-element-in-the-array/"><strong>GetLowerBound()</strong></a></td><td>Gets the index of the first element of the specified dimension in the array.</td><td>arrVal.GetLowerBound(i) where i is an integer</td></tr>
<tr><td><strong>GetType()</strong></td><td>Gets the Type of the current instance.</td><td>arrVal.GetType()</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-finding-the-index-of-last-element-in-the-array/"><strong>GetUpperBound()</strong></a></td><td>Gets the index of the last element of the specified dimension in the array.</td><td>arrVal.GetUpperBound(i) where i is an integer</td></tr>
<tr><td><strong>GetValue()</strong></td><td>Gets the value of the specified element in the current Array.</td><td> </td></tr>
<tr><td><strong>IndexOf()</strong></td><td>Searches for the specified object and returns the index of its first occurrence in a one-dimensional array or in a range of elements in the array.</td><td>arrVal.IndexOf(object)</td></tr>
<tr><td><strong>Initialize()</strong></td><td>Initializes every element of the value-type Array by calling the default constructor of the value type.</td><td> </td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/array-lastindexof-method-in-c-sharp-set-1/"><strong>LastIndexOf()</strong></a></td><td>Returns the index of the last occurrence of a value in a one-dimensional Array or in a portion of the Array.</td><td>arrVal.LastIndexOf(i)</td></tr>
<tr><td><strong>MemberwiseClone()</strong></td><td>Creates a shallow copy of the current Object.</td><td> </td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-how-to-change-the-size-of-one-dimensional-array/"><strong>Resize()</strong></a></td><td>Changes the number of elements of a one-dimensional array to the specified new size.</td><td>Array.Resize(ref arrVal, len-2);where len is the original length of the array</td></tr>
<tr><td><strong>Reverse()</strong></td><td>Reverses the order of the elements in a one-dimensional Array or in a portion of the Array.</td><td>arrVal.Reverse()</td></tr>
<tr><td><strong>SetValue()</strong></td><td>Sets the specified element in the current Array to the specified value.</td><td>Array.SetValue(arrVal[i])</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/how-to-sort-an-array-in-c-sharp-array-sort-method-set-1/"><strong>Sort()</strong></a></td><td>Sorts the elements in a one-dimensional array.</td><td>Array.Sort(arrVal)</td></tr>
<tr><td><strong>ToString()</strong></td><td>Returns a string that represents the current object. (Inherited from Object)</td><td>arrVal.ToString()</td></tr>
<tr><td><a href="https://www.geeksforgeeks.org/c-array-trueforall-method/"><strong>TrueForAll()</strong></a></td><td>Determines whether every element in the array matches the conditions defined by the specified predicate.</td><td>Array.TrueForAll(arrVal, <matching pattern>)</td></tr>
</tbody></table>
</div>
<h3 id="control-statements"><a class="header" href="#control-statements"><strong>Control Statements</strong></a></h3>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td>if-else</td><td>if (true) {…} else if (true) {…} else {…}</td></tr>
<tr><td>switch</td><td>switch (var){ case 1: break;case 2: break; default: break;}</td></tr>
<tr><td>for</td><td>for (int i =0; i &lt;=len; i++) {…}</td></tr>
<tr><td>foreach-in</td><td>foreach (int item in array) {…}</td></tr>
<tr><td>while</td><td>while (true) {…}</td></tr>
<tr><td>do… while</td><td>do {…} while (true);</td></tr>
<tr><td>try-catch-finally</td><td>try {…} catch (Exception e) {…} catch {…} finally {…}</td></tr>
</tbody></table>
</div>
<h3 id="regular-expressions"><a class="header" href="#regular-expressions"><strong>Regular Expressions</strong></a></h3>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td>+</td><td>match one or more occurrence</td></tr>
<tr><td>*</td><td>match any occurrence (zero or more)</td></tr>
<tr><td>?</td><td>match 0 or 1 occurrence</td></tr>
<tr><td>\d \D</td><td>match decimal digit or non-character</td></tr>
<tr><td>\w \W</td><td>match any word character</td></tr>
<tr><td>\s \S</td><td>match white space or no white space</td></tr>
<tr><td>[]</td><td>match any character inside the square brackets</td></tr>
<tr><td>[^]</td><td>match any character not present in the square brackets</td></tr>
<tr><td>a</td><td>b</td></tr>
<tr><td>\n</td><td>new line</td></tr>
<tr><td>\r</td><td>carriage return</td></tr>
<tr><td>\t</td><td>tab</td></tr>
</tbody></table>
</div>
<h3 id="collections"><a class="header" href="#collections"><strong>Collections</strong></a></h3>
<h4 id="arraylist"><a class="header" href="#arraylist"><strong>Arraylist</strong></a></h4>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td>Capacity</td><td>Gets or sets the number of elements that the ArrayList can contain.</td></tr>
<tr><td>Count</td><td>Gets the number of elements actually contained in the ArrayList.</td></tr>
<tr><td>IsFixedSize</td><td>Gets a value indicating whether the ArrayList has a fixed size.</td></tr>
<tr><td>IsReadOnly</td><td>Returns whether the ArrayList is read-only</td></tr>
<tr><td>Item</td><td>Gets or sets the element at the specified index.</td></tr>
<tr><td>Add(object value)</td><td>Adds an object to the end of the ArrayList</td></tr>
<tr><td>AddRange(ICollection c);</td><td>Adds the elements of an ICollection to the end of the ArrayList.</td></tr>
<tr><td>Clear();</td><td>Removes all elements of an ArrayList.</td></tr>
<tr><td>Contains(object item);</td><td>Checks whether an element is in the ArrayList.</td></tr>
<tr><td>GetRange(int index, int count);</td><td>Returns an ArrayList which represents a subset of the elements in the source ArrayList.</td></tr>
<tr><td>IndexOf(object);</td><td>Returns the zero-based index of the first occurrence of a value in the ArrayList or in a portion of it.</td></tr>
<tr><td>Insert(int index, object value);</td><td>Inserts an element into the ArrayList at the specified index.</td></tr>
<tr><td>InsertRange(int index, ICollection c);</td><td>Inserts the elements of a collection into the ArrayList at the specified index.</td></tr>
<tr><td>Remove(object obj);</td><td>Removes the first occurrence of a specific object from the ArrayList.</td></tr>
<tr><td>RemoveAt(int index);</td><td>Removes the element at the specified index of the ArrayList.</td></tr>
<tr><td>RemoveRange(int index, int count);</td><td>Removes a range of elements from the ArrayList</td></tr>
<tr><td>Reverse();</td><td>Reverses the order of the elements in the ArrayList.</td></tr>
<tr><td>SetRange(int index, ICollection c);</td><td>Copies the elements of a collection over a range of elements in the ArrayList.</td></tr>
<tr><td>Sort();</td><td>Sorts the elements in the ArrayList.</td></tr>
<tr><td>TrimToSize();</td><td>Sets the capacity to the actual number of elements in the ArrayList.</td></tr>
</tbody></table>
</div>
<h4 id="hashtable"><a class="header" href="#hashtable"><strong>Hashtable</strong></a></h4>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td>Count</td><td>Gets the number of key-and-value pairs contained in the Hashtable.</td></tr>
<tr><td>IsFixedSize</td><td>Gets a value indicating whether the Hashtable has a fixed size</td></tr>
<tr><td>IsReadOnly</td><td>Gets a value indicating whether the Hashtable is read-only.</td></tr>
<tr><td>Item</td><td>Gets or sets the value associated with the specified key.</td></tr>
<tr><td>Keys</td><td>Gets an ICollection containing the keys in the Hashtable.</td></tr>
<tr><td>Values</td><td>Gets an ICollection containing the values in the Hashtable</td></tr>
<tr><td>Add(object key, object value);</td><td>Adds an element with the specified key and value into the Hashtable</td></tr>
<tr><td>Clear();</td><td>Removes all elements from the Hashtable.</td></tr>
<tr><td>ContainsKey(object key);</td><td>Determines whether the Hashtable contains a specific key.</td></tr>
<tr><td>ContainsValue(object value);</td><td>Determines whether the Hashtable contains a specific value.</td></tr>
<tr><td>Remove(object key);</td><td>Removes the element with the specified key from the Hashtable.</td></tr>
</tbody></table>
</div>
<h4 id="sortedlist"><a class="header" href="#sortedlist"><strong>SortedList</strong></a></h4>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td>Capacity</td><td>Gets or sets the capacity of the SortedList.</td></tr>
<tr><td>Count</td><td>Gets the number of elements in the SortedList.</td></tr>
<tr><td>IsFixedSize</td><td>Checks if the SortedList is of fixed size.</td></tr>
<tr><td>IsReadOnly</td><td>Checks if the SortedList is read-only.</td></tr>
<tr><td>Item</td><td>Gets and sets the value associated with a specific key in the SortedList.</td></tr>
<tr><td>Keys</td><td>Gets the keys in the SortedList.</td></tr>
<tr><td>Values</td><td>Gets the values in the SortedList.</td></tr>
<tr><td>Add(object key, object value)</td><td>Adds an element with the specified key and value into the SortedList.</td></tr>
<tr><td>Clear()</td><td>Removes all elements from the SortedList.</td></tr>
<tr><td>ContainsKey(object key);</td><td>Checks if the SortedList contains a specific key.</td></tr>
<tr><td>ContainsValue(object value);</td><td>Checks if the SortedList contains a specific value.</td></tr>
<tr><td>GetByIndex(int index);</td><td>Gets the value at the specified index of the SortedList.</td></tr>
<tr><td>GetKey(int index);</td><td>Gets the key at the specified index of the SortedList.</td></tr>
<tr><td>GetKeyList();</td><td>Returns list of keys in the SortedList</td></tr>
<tr><td>GetValueList();</td><td>Returns list of values in the SortedList</td></tr>
<tr><td>IndexOfKey(object key);</td><td>Returns the zero-based index of the specified key in the SortedList.</td></tr>
<tr><td>IndexOfValue(object value);</td><td>Returns the zero-based index of the first occurrence of the specified value in the SortedList.</td></tr>
<tr><td>Remove(object key);</td><td>Removes the element with the specified key from the SortedList.</td></tr>
<tr><td>RemoveAt(int index);</td><td>Removes the element at the specified index of SortedList.</td></tr>
<tr><td>TrimToSize();</td><td>Sets the capacity to the actual number of elements in the SortedList.</td></tr>
</tbody></table>
</div>
<h4 id="stack"><a class="header" href="#stack"><strong>Stack</strong></a></h4>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td>Count</td><td>Number of elements in the Stack.</td></tr>
<tr><td>Clear();</td><td>Removes all elements from the Stack.</td></tr>
<tr><td>Contains(object obj);</td><td>Checks if an element is in the Stack.</td></tr>
<tr><td>Peek();</td><td>Returns the object at the top of the Stack without removing it.</td></tr>
<tr><td>Pop();</td><td>Removes and returns the object at the top of the Stack.</td></tr>
<tr><td>Push(object obj);</td><td>Inserts an object at the top of the Stack.</td></tr>
<tr><td>ToArray();</td><td>Copies the Stack to a new array.</td></tr>
</tbody></table>
</div>
<h4 id="queue"><a class="header" href="#queue"><strong>Queue</strong></a></h4>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td>Count</td><td>number of elements in the Queue.</td></tr>
<tr><td>Clear();</td><td>Removes all elements from the Queue.</td></tr>
<tr><td>Contains(object obj);</td><td>Checks if the specified object is present in the Queue.</td></tr>
<tr><td>Dequeue();</td><td>Removes and returns the object at the beginning of the Queue.</td></tr>
<tr><td>Enqueue(object obj);</td><td>Adds an object to the end of the Queue.</td></tr>
<tr><td>ToArray();</td><td>Copies the Queue to a new array.</td></tr>
<tr><td>TrimToSize();</td><td>Sets the capacity to the actual number of elements in the Queue.</td></tr>
</tbody></table>
</div>
<h4 id="dictionary"><a class="header" href="#dictionary"><strong>Dictionary</strong></a></h4>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td>Count</td><td>Gets the total number of elements exists in the Dictionary&lt;TKey,TValue&gt;.</td></tr>
<tr><td>IsReadOnly</td><td>Returns a boolean after checking if the Dictionary&lt;TKey,TValue&gt; is read-only.</td></tr>
<tr><td>Item</td><td>Gets or sets the element with the specified key in the Dictionary&lt;TKey,TValue&gt;.</td></tr>
<tr><td>Keys</td><td>Returns collection of keys of Dictionary&lt;TKey,TValue&gt;.</td></tr>
<tr><td>Values</td><td>Returns collection of values in Dictionary&lt;TKey,TValue&gt;.</td></tr>
<tr><td>Add</td><td>Add key-value pairs in Dictionary&lt;TKey, TValue&gt; collection.</td></tr>
<tr><td>Remove</td><td>Removes the first occurrence of specified item from the Dictionary&lt;TKey, TValue&gt;.</td></tr>
<tr><td>ContainsKey</td><td>Checks if the specified key exists in Dictionary&lt;TKey, TValue&gt;.</td></tr>
<tr><td>ContainsValue</td><td>Checks if the specified value exists in Dictionary&lt;TKey, TValue&gt;.</td></tr>
<tr><td>Clear</td><td>Removes all the elements from Dictionary&lt;TKey, TValue&gt;.</td></tr>
<tr><td>TryGetValue</td><td>Returns true and assigns the value with specified key, if key does not exists then return false.</td></tr>
</tbody></table>
</div>
<h3 id="exception-handling"><a class="header" href="#exception-handling"><strong>Exception Handling</strong></a></h3>
<pre><code>try{
} catch (Exception e){
throw;
}
</code></pre>
<h4 id="methods"><a class="header" href="#methods"><strong>Methods</strong></a></h4>
<div class="table-wrapper"><table><thead><tr><th></th><th></th></tr></thead><tbody>
<tr><td>No return type</td><td>public void MyMethod(){}</td></tr>
<tr><td>static method, no object needed to call method</td><td>public static void MyMethod(){}</td></tr>
<tr><td>with return type</td><td>public returnType MyMethod(){return val;}</td></tr>
<tr><td>passing parameters</td><td>public void MyMethod(String s, int i) {}</td></tr>
</tbody></table>
</div>
<h4 id="classes"><a class="header" href="#classes"><strong>Classes</strong></a></h4>
<pre><code class="language-c#">Class MyClass
{
/*Class definition*/
}
Object creation
MyClass ClassObj = new MyClass();
</code></pre>
<h4 id="partial-class"><a class="header" href="#partial-class"><strong>Partial Class</strong></a></h4>
<p>Classes within the same namespace can be split into smaller classes with same name.</p>
<pre><code>// PartialClass1.cs
using System;
namespace PartialClasses
{
public partial class PartialClass
{
public void HelloWorld()
{
Console.WriteLine(&quot;Hello, world!&quot;);
}
}
}
</code></pre>
<pre><code>// PartialClass2.cs
using System;
namespace PartialClasses
{
public partial class PartialClass
{
public void HelloUser()
{
Console.WriteLine(&quot;Hello, user!&quot;);
}
}
}
</code></pre>
<p>A single instance is enough to call the methods of these partial classes.</p>
<pre><code>PartialClass pc = new PartialClass();
pc.HelloWorld();
pc.HelloUser();
</code></pre>
<h3 id="file-handling"><a class="header" href="#file-handling"><strong>File Handling</strong></a></h3>
<div class="table-wrapper"><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody>
<tr><td>File.Exists</td><td>Check the existence of the file in the specified path</td><td>File.Exists(path)</td></tr>
<tr><td>File.ReadAllLines</td><td>Read all the lines from the file specified by the path</td><td>File.ReadAllLines(path)Console.WriteLines(File.ReadAllLines(path)// Write to console</td></tr>
<tr><td>File.ReadAllText</td><td>Read all the text from the file and store it as a single string</td><td>File.ReadAllText(path)</td></tr>
<tr><td>File.Copy</td><td>Copy content from one file to another</td><td>File.Copy(srcfilepath, destfilepath);</td></tr>
<tr><td>File.Delete</td><td>Delete an existing file from the specified path</td><td>File.Delete(path)</td></tr>
</tbody></table>
</div>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="../../posts/windows/windows10_use_powershell_dedup_redundent_path.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next" href="../../posts/cs/learn_cs_basics.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="../../posts/windows/windows10_use_powershell_dedup_redundent_path.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next" href="../../posts/cs/learn_cs_basics.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script>
window.playground_line_numbers = true;
</script>
<script>
window.playground_copyable = true;
</script>
<script src="../../ace.js"></script>
<script src="../../editor.js"></script>
<script src="../../mode-rust.js"></script>
<script src="../../theme-dawn.js"></script>
<script src="../../theme-tomorrow_night.js"></script>
<script src="../../elasticlunr.min.js"></script>
<script src="../../mark.min.js"></script>
<script src="../../searcher.js"></script>
<script src="../../clipboard.min.js"></script>
<script src="../../highlight.js"></script>
<script src="../../book.js"></script>
<!-- Custom JS scripts -->
<script src="../../src/js/custom.js"></script>
</div>
</body>
</html>