Listing out directories and files using C#

karthikeya Boyini
Updated on 21-Jun-2020 12:41:57

290 Views

The Directory class in C# has many methods to perform operations on directories and sub-directories −Sr.NoMethod & Description1CreateDirectory(String)Creates all directories and subdirectories in the specified path unless they already exist.2CreateDirectoryDirectorySecurity(String)Creates all the directories in the specified path, unless the already exist, applying the specified Windows security.3Delete(String)Deletes an empty directory from a specified path.4DeleteBoolean(String)Deletes the specified directory and, if indicated, any subdirectories and files in the directory.5EnumerateDirectories(String)Returns an enumerable collection of directory names in a specified path.6EnumerateDirectories(String, String)Returns an enumerable collection of directory names that match a search pattern in a specified path.To get the directory names, use the EnumerateDirectories method. ... Read More

Mathematical Functions in C#

karthikeya Boyini
Updated on 21-Jun-2020 12:41:40

1K+ Views

The System.Math class in C# provides methods are properties to perform mathematical operations, trigonometric, logarithmic calculations, etc.Some of its methods include −Sr.NoMethod & Description1Abs(Decimal)Returns the absolute value of a Decimal number.2Abs(Double)Returns the absolute value of a double-precision floating-point number.3Abs(Int16)Returns the absolute value of a 16-bit signed integer.4Abs(Int32)Returns the absolute value of a 32-bit signed integer.5Abs(Int64)Returns the absolute value of a 64-bit signed integer.6Abs(SByte)Returns the absolute value of an 8-bit signed integer.7Abs(Single)Returns the absolute value of a single-precision floating-point number.8Acos(Double)Returns the angle whose cosine is the specified number.9Asin(Double)Returns the angle whose sine is the specified number.10Atan(Double)Returns the angle whose tangent is ... Read More

Logical Operators on String in C#

George John
Updated on 21-Jun-2020 12:40:48

1K+ Views

The following are the logical operators that you can use on Strings in C#.OperatorDescriptionExample&&Called Logical AND operator. If both the operands are non zero then condition becomes true.(A && B) is false.||Called Logical OR Operator. If any of the two operands is non zero then condition becomes true.(A || B) is true.!Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false.!(A && B) is true.Let us see an example showing how to use logical AND operator on strings −Example Live Demousing System; using System.Collections.Generic; using System.Linq; ... Read More

Different ways for Integer to String conversion in Java

Fendadis John
Updated on 21-Jun-2020 12:40:05

125 Views

Following are the different ways to convert an Integer to String in Java.Using Integer.toString(int) − Convert an int to String using static toString() method of Integer class.String b = Integer.toString(125);Using String.valueOf(int) − Convert an int to String using static valueOf() method of String class.String b = String.valueOf(125);Using new Integer(int).toString() − Convert an int to String using toString() method of Integer object.String b = new Integer(125).toString();Using DecimalFormat(pattern).format(int) − Convert an int to String using DecimalFormat.format() method.String b = new DecimalFormat("#").format(125);Using StringBuilder().toString() − Convert an int to String using StringBuilder.toString() method.String b = new StringBuilder().append(125).toString();Using StringBuffer().toString() − Convert an int to String ... Read More

What is a copy constructor in C#?

Samual Sam
Updated on 21-Jun-2020 12:39:00

2K+ Views

Copy Constructor creates an object by copying variables from another object.Let us see an example −Exampleusing System; namespace Demo {    class Student {       private string name;       private int rank;       public Student(Student s) {          name = s.name;          rank = s.rank;       }       public Student(string name, int rank) {          this.name = name;          this.rank = rank;       }       public string Display {     ... Read More

What is a pre-processor directive in C#?

Ankith Reddy
Updated on 21-Jun-2020 12:38:00

209 Views

C# compiler does not have a separate preprocessor; however, the directives are processed as if there was one. In C# the preprocessor directives are used to help in conditional compilation.The preprocessor directives give instruction to the compiler to preprocess the information before actual compilation starts.The following are the preprocessor directives in C# −Sr.No.Preprocessor Directive & Description1#defineIt defines a sequence of characters, called symbol.2#undefIt allows you to undefine a symbol.3#ifIt allows testing a symbol or symbols to see if they evaluate to true.4#elseIt allows to create a compound conditional directive, along with #if.5#elifIt allows creating a compound conditional directive.6#endifSpecifies the end ... Read More

Structure of a Client Server System

Ricky Barnes
Updated on 21-Jun-2020 12:37:22

4K+ Views

In client server computing, the clients requests a resource and the server provides that resource. A server may serve multiple clients at the same time while a client is in contact with only one server.The different structures for two tier and three tier are given as follows −Two - Tier Client/Server StructureThe two tier architecture primarily has two parts, a client tier and a server tier.The client tier sends a request to the server tier and the server tier responds with the desired information.An example of a two tier client/server structure is a web server. It returns the required web ... Read More

What are types in C#?

Ankith Reddy
Updated on 21-Jun-2020 12:36:45

88 Views

The types in C# include the following −Value TypesValue type variables can be assigned a value directly. They are derived from the class System.ValueType.The value types directly contain data. Some examples are int, char, and float, which stores numbers, alphabets, and floating point numbers, respectively. When you declare an int type, the system allocates memory to store the value.Reference TypesThe reference types do not contain the actual data stored in a variable, but they contain a reference to the variables.Pointer TypesPointer type variables store the memory address of another type. Pointers in C# have the same capabilities as the pointers ... Read More

Single Processor Systems

Alex Onsman
Updated on 21-Jun-2020 12:36:31

12K+ Views

A single processor system contains only one processor. So only one process can be executed at a time and then the process is selected from the ready queue. Most general purpose computers contain the single processor systems as they are commonly in use.A single processor system can be further described using the diagram below −As in the above diagram, there are multiple applications that need to be executed. However, the system contains a single processor and only one process can be executed at a time.Differences Between Single Processor and Multiprocessor SystemsThere are many differences between single processor and multiprocessor systems.Some ... Read More

Difference between HashTable and HashMap in Java

Rishi Raj
Updated on 21-Jun-2020 12:35:45

3K+ Views

Following are the notable differences between HashTable and HashMap classes in Java. HashTableHashMapSynchronizedHashTable is synchronized.HashMap is not synchronized.Thread SafeHashTable is thread safe.HashMap is not thread safe.Null objectsHashTable does not allows null keys or null values.HashMap allows one null key and multiple null values.PerformanceHashTable is faster.HashMap is slower than HashTable.Since Java Version1.21.5Exampleimport java.util.HashMap; import java.util.Hashtable; import java.util.Map; public class Tester {    public static void main(String args[]) {       Map map = new HashMap();       map.put("1", "One");       map.put("2", "Two");       map.put("3", "Three");       map.put("5", "Five");       ... Read More

Advertisements