 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to call custom methods in C#?
To define a custom method in C#, use the following syntax −
<Access Specifier> <Return Type> <Method Name>(Parameter List) {    Method Body } To call a custom method, try to run the following code. It has the checkPalindrome() method which is called to checker whether the binary representation is Palindrome or not −
Example
using System; public class Demo {    public static long funcReverse(long num) {       long myRev = 0;       while (num > 0) {          myRev <<= 1;          if ((num & 1) == 1)          myRev ^= 1;          num >>= 1;       }       return myRev;    }    public static bool checkPalindrome(long num) {       long myRev = funcReverse(num);       return (num == myRev);    }    public static void Main() {       // Binary value of 5 us 101       long num = 5;       if (checkPalindrome(num))       Console.WriteLine("Palindrome Number");       else       Console.WriteLine("Not a Palindrome Number");    } }  Output
Palindrome Number
Advertisements
 