[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-617644-105":3,"detail-sidebar-cat-1-en-105":80,"doc-detail-617644-en":126,"doc-similar-617644":148},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","c-cheatsheet-methods-code-examples","C# CheatSheet - Methods - Code Examples","","C# CheatSheet provides a compact reference for core C# programming concepts and common syntax patterns. It covers fundamental data types and their storage/precision characteristics, displaying variable values, and basic operators including arithmetic and remainder. The cheat sheet also summarizes method declaration forms, parameter passing, return values, and conversion methods (e.g., boolean, integer, floating-point, strings). Additional sections cover arrays, array functions, conditional operators, and control-flow loops including if/while/for/do-while and multidimensional arrays.",{"@graph":14,"@context":72},[15,34,55],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/template/","Template",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/template/presentations/","Presentations",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/template/c-cheatsheet-methods-code-examples/617644/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/c-cheatsheet-methods-code-examples/617644.png","ImageObject",442,249,{"name":42,"@type":43},"Eliana","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-12-02","2026-10-19",true,{"@type":52,"interactionType":53,"userInteractionCount":30},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"What are the key differences among C# numeric data types like float, double, and decimal?","Question",{"text":62,"@type":63},"Float and double differ in precision and significant digits, while decimal offers greater precision with a smaller range and is suitable for financial and monetary calculations.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"How do you declare and call C# methods with parameters and return values?",{"text":67,"@type":63},"Method declarations specify signature and body, including whether there is a return value. Calls invoke the method, passing required parameters and using the return value when applicable.",{"name":69,"@type":60,"acceptedAnswer":70},"Which operators and loop types are summarized in the cheat sheet?",{"text":71,"@type":63},"It summarizes arithmetic operators (+, -, *, /, %) plus conditional AND (&&) and OR (||), and loop constructs including if statements, while loops, for loops, and do-while loops, along with multidimensional arrays.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},617644,1792442958,{"code":4,"msg":81,"data":82},"success",[83,87,92,97,102,107,112,117,122],{"id":84,"doc_module":22,"doc_module_name":25,"category_name":29,"show_sort_weight":85,"slug":86},11,90,"presentations",{"id":88,"doc_module":22,"doc_module_name":25,"category_name":89,"show_sort_weight":90,"slug":91},12,"Resumes",80,"resumes",{"id":93,"doc_module":22,"doc_module_name":25,"category_name":94,"show_sort_weight":95,"slug":96},14,"Invoices",70,"invoices",{"id":98,"doc_module":22,"doc_module_name":25,"category_name":99,"show_sort_weight":100,"slug":101},15,"Posters",60,"posters",{"id":103,"doc_module":22,"doc_module_name":25,"category_name":104,"show_sort_weight":105,"slug":106},16,"Social Media",50,"social-media",{"id":108,"doc_module":22,"doc_module_name":25,"category_name":109,"show_sort_weight":110,"slug":111},17,"Forms",40,"forms",{"id":113,"doc_module":22,"doc_module_name":25,"category_name":114,"show_sort_weight":115,"slug":116},18,"Letters",30,"letters",{"id":118,"doc_module":22,"doc_module_name":25,"category_name":119,"show_sort_weight":120,"slug":121},21,"Paper Templates",5,"papers-templates",{"id":123,"doc_module":22,"doc_module_name":25,"category_name":124,"show_sort_weight":4,"slug":125},158,"General","general-158",{"code":4,"msg":81,"data":127},{"doc_id":78,"user_id":128,"nickname":42,"user_avatar":129,"doc_module":22,"category_id":84,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":130,"file_id":131,"file_url":132,"file_type":133,"file_size":134,"view_count":30,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":26,"language":135,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":136,"faqs":137,"seo_title":138,"seo_description":12,"update_tm":79,"read_time":22,"preview_page_count":26,"preview_urls":139},4398048949847,"https://ap-avatar.wpscdn.com/avatar/400002536579ef2da7f?_k=1778318612642679267","C\\# CheatSheet Cheat Sheet  \n[by](by pao361 via cheatography.com/140352/cs/29786/)[ pao361](by pao361 via cheatography.com/140352/cs/29786/)[ via](by pao361 via cheatography.com/140352/cs/29786/)[ cheatography.com/140352/cs/29786/](by pao361 via cheatography.com/140352/cs/29786/)  \nData Types  \n\n| string\u003Cbr>bool\u003Cbr>char\u003Cbr>byte\u003Cbr>short\u003Cbr>int\u003Cbr>long\u003Cbr>float\u003Cbr>double\u003Cbr>decimal |  | 2 bytes/char\u003Cbr>2 bytes\u003Cbr>1 byte\u003Cbr>2 bytes\u003Cbr>4 bytes\u003Cbr>8 bytes\u003Cbr>4 bytes\u003Cbr>8 bytes\u003Cbr>16 bytes |  |  |\n| --- | --- | --- | --- | --- |\n| Float: Can hold up to seven significant digits of accuracy\u003Cbr>Double: Can hold 15 or 16 significant digits of accuracy\u003Cbr>Decimal: Has a greater precision and a smaller range. Suitable for financial and monetary calculations\u003Cbr>Displaying Variable Values |  |  |  |  |\n| using System;\u003Cbr>public class Displa ySo meMoney [\u003Cbr>public static void Main ()\u003Cbr>{\u003Cbr>‐\u003Cbr>double someMoney = 39 .45;\u003Cbr>‐\u003Cbr>Con sol e.W rit eLi ne ( som eMo ‐ ney);\u003Cbr>}\u003Cbr>[\u003Cbr>Operators |  |  |  |  |\n| + | Addition |  | - | Subtraction |\n| * | Multiplication |  | / | Division |\n| % | Remainder |  |  |  |\n\nBy pao361  \n[cheatography.com/pao361/](cheatography.com/pao361/)  \nSuffixes  \n\n| \u003Cbr>Put an F after a number to make it a float float pocketchange = 4.87F;\u003Cbr>Put a D after it to make it a double (default) float pocketchange = 4.87D;\u003Cbr>Put an M (money) after it to make it a decimal\u003Cbr>float pocketchange = 4.87M;\u003Cbr>Scientific notation\u003Cbr>Includes an E (for exponent)\u003Cbr>Methods |\n| --- |\n| Define it – takes 4 steps Declaration (or method header, or signature)\u003Cbr>{\u003Cbr>Code (method body) Return value;\u003Cbr>}\u003Cbr>Call it (invoke it)\u003Cbr>Method declarations |\n| Method with no return value, and passes no parameters\u003Cbr>public static void DisplayHelloText() DisplayHelloText();\u003Cbr>Method with no return value, and passes one parameter\u003Cbr>public static void DisplaySalesTax(double pAmt)\u003Cbr>DisplaySalesTax(1243 .00);\u003Cbr>Method with no return value, and passes two parameters\u003Cbr>public static void DisplaySalesTax(double pAmt, double ptaxRate)\u003Cbr>DisplaySalesTax (1243 .00 , .09);\u003Cbr>Method that returns a value, and passes two parameters |\n\nPublished 8th January , 2022.  \nLast updated 19th November, 2021. Page 1 of 2.  \nMethod declarations (cont)  \npublic static double DisplaySalesTax‐(double pAmt, double ptaxRate)  \nAmount = DisplaySalesTax (1243 .00 , .09); return Answer;  \n(if no return , then void , else , return type , e.g. integer32 , string , double , etc)  \nConvert Methods  \n1 eg  \n3 eg  \n6 eg  \nsiv nge  \nn  \n1  \ngg  \n\n| ToBool‐ to an |  | ToInt16() | to a |\n| --- | --- | --- | --- |\n| ean() equivalent |  |  | sign |\n| Boolean value |  |  | inte |\n| ToByte() to an 8-bit |  | ToInt32() | to a |\n| unsigned |  |  | sign |\n| integer |  |  | inte |\n| ToChar() to a |  | ToInt64() | to a |\n| Unicode |  |  | sign |\n| character |  |  | inte |\n| ToDeci‐ to a |  | ToString() | to it |\n| mal() decimal |  |  | equ |\n| number |  |  | Stri |\n|  |  |  | repr |\n|  |  |  | atio |\n| ToDouble() to a |  | ToUInt16() | to a |\n| double- |  |  | unsi |\n| precision\u003Cbr>floating-‐ point |  |  | inte |\n| number |  |  |  |\n| Arrays Functions |  |  |  |\n| Array.Sort(arra‐ yName) | Arranges array items in ascending order |  |  |\n| Array. Length | Length of the array |  |  |\n| Array. Revers‐ | Reverses the order of |  |  |\n| e(arrayName) | items in an array |  |  |\n\nSponsored by Readable.com Measure your website readability!  \n[https://readable.com](https://readable.com)  \nC\\# CheatSheet Cheat Sheet  \n[by](by pao361 via cheatography.com/140352/cs/29786/)[ pao361](by pao361 via cheatography.com/140352/cs/29786/)[ via](by pao361 via cheatography.com/140352/cs/29786/)[ cheatography.com/140352/cs/29786/](by pao361 via cheatography.com/140352/cs/29786/)  \nArrays Functions (cont) Conditional Operators  \nArray. BinarySea‐ rch(ArrayName , value)  \nFinds a requested value in a sorted array  \nDo not use BinarySearch() under these circumstances  \nIf your array items are not arranged in","cbCaiqAIGX3fLcgJ","https://ap.wps.com/l/cbCaiqAIGX3fLcgJ","pdf",68304,"English","# Data Types\n## Displaying Variable Values\n## Operators\n# Methods\n## Method declarations\n## Convert Methods\n# Arrays Functions\n## Conditional Operators\n## Loops","[{\"question\":\"What are the key differences among C# numeric data types like float, double, and decimal?\",\"answer\":\"Float and double differ in precision and significant digits, while decimal offers greater precision with a smaller range and is suitable for financial and monetary calculations.\"},{\"question\":\"How do you declare and call C# methods with parameters and return values?\",\"answer\":\"Method declarations specify signature and body, including whether there is a return value. Calls invoke the method, passing required parameters and using the return value when applicable.\"},{\"question\":\"Which operators and loop types are summarized in the cheat sheet?\",\"answer\":\"It summarizes arithmetic operators (+, -, *, /, %) plus conditional AND (\\u0026\\u0026) and OR (||), and loop constructs including if statements, while loops, for loops, and do-while loops, along with multidimensional arrays.\"}]","C# CheatSheet - Methods - Code Examples | PDF",[140,144],{"page_no":22,"url":141,"width":142,"height":143},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/548a942e114a6b8eef654f2193e2ab56.webp",983,1390,{"page_no":26,"url":145,"width":146,"height":147},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/ec8a1ab3143cdcf6f59b4906421e7370.webp",982,1389,{"list":149,"token":11},[150,156,162,169,175,181,187,193,199,205],{"doc_id":151,"doc_title":152,"file_type":133,"home_preview_img_url":153,"slug":154,"view_count":93,"category_name":29,"create_tm":155},573485,"JAVA PROGRAMMING CHEATSHEET - Built-in Data Types and Operators - Quick Reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950881322/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=4BYIyqIT86I82tqjIY9TCcoAb7Q%3D","java-programming-cheatsheet-built-in-data-types-and-operators-quick-reference",1791940743,{"doc_id":157,"doc_title":158,"file_type":133,"home_preview_img_url":159,"slug":160,"view_count":103,"category_name":29,"create_tm":161},573480,"CORE JAVA CHEATSHEET - Arrays and Strings - Quick Reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950878995/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=GpzrMKiBvii0hbm7KKgFku8%2FqXo%3D","core-java-cheatsheet-arrays-and-strings-quick-reference",1791940660,{"doc_id":163,"doc_title":164,"file_type":133,"home_preview_img_url":165,"slug":166,"view_count":167,"category_name":29,"create_tm":168},571522,"Javascript Cheat Sheet - Beginner’s Essential","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950718774/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=U741nok%2FBW%2Fc%2FQSLvLhcY47jQiY%3D","javascript-cheat-sheet-beginners-essential",22,1791921873,{"doc_id":170,"doc_title":171,"file_type":133,"home_preview_img_url":172,"slug":173,"view_count":103,"category_name":29,"create_tm":174},573477,"QUICK REFERENCE - JAVA - Java 17+ Core Syntax Cheatsheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950878931/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=W1DMN%2FJOyJ1jYVtTrXny9UAx%2FwQ%3D","quick-reference-java-java-17-core-syntax-cheatsheet",1791940654,{"doc_id":176,"doc_title":177,"file_type":133,"home_preview_img_url":178,"slug":179,"view_count":118,"category_name":29,"create_tm":180},572519,"PowerShell Cheat Sheet - Variables - Arrays - Strings - Flow Control - Operators","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950578365/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=GomCZNv%2FTrbOu2L5alkaQPjFQ%2Fs%3D","powershell-cheat-sheet-variables-arrays-strings-flow-control-operators",1791927841,{"doc_id":182,"doc_title":183,"file_type":133,"home_preview_img_url":184,"slug":185,"view_count":167,"category_name":29,"create_tm":186},572242,"Beginners Python Cheat Sheet - Basic Python Concepts","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950736453/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=Z4H%2FgLbmmzPjs6Ghc%2BU1njF1p%2Fk%3D","beginners-python-cheat-sheet-basic-python-concepts",1791926334,{"doc_id":188,"doc_title":189,"file_type":133,"home_preview_img_url":190,"slug":191,"view_count":113,"category_name":29,"create_tm":192},571787,"Python Cheatsheet - Essential syntax, structures, and patterns for modern Python development","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950726288/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=leYUhPYHGpnEj8dgBI480mWzmNw%3D","python-cheatsheet-essential-syntax-structures-and-patterns-for-modern-python-development",1791923728,{"doc_id":194,"doc_title":195,"file_type":133,"home_preview_img_url":196,"slug":197,"view_count":113,"category_name":29,"create_tm":198},572241,"Python Basics Cheat Sheet - read online free","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950573381/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=eRDgncWn3vT18qdaZYe1umzAXts%3D","python-basics-cheat-sheet-read-online-free",1791926333,{"doc_id":200,"doc_title":201,"file_type":133,"home_preview_img_url":202,"slug":203,"view_count":167,"category_name":29,"create_tm":204},571390,"QUICK REFERENCE - PYTHON 3 - Python Essentials, at a glance - Syntax & Collections - Control Flow & Practical Tools","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950542873/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=sf1kZwftEw2GVRDc%2BK4p7WDMhKc%3D","quick-reference-python-3-python-essentials-at-a-glance-syntax-collections-control-flow-practical-tools",1791914949,{"doc_id":206,"doc_title":207,"file_type":133,"home_preview_img_url":208,"slug":209,"view_count":118,"category_name":29,"create_tm":210},572023,"UVa HSPC C++ Cheatsheet - Quick Reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950732362/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=HICw7nuJY7nw5g0BJiuYmOXHTeg%3D","uva-hspc-c-cheatsheet-quick-reference",1791925094]