| C# Question Answers-101 - 110 | C# Threading QA-1-10 | |
C# (C-Sharp) Question Answers - 111-120 |
Note: Actual usable memory may vary based on system configuration, OS version, and available physical memory.
using System;
static int Compute(int a)
{
if (a <= 1) return 1;
return a + Compute(a - 2);
}
static void Cal(int a)
{
if (a >= 1)
{
Console.Write("{0}, ", a);
a -= 2;
Cal(a);
}
}
public static void Main()
{
const int Number = 9;
Console.WriteLine("Result "); Cal(Number);
Console.WriteLine();
Console.WriteLine("Result: {0}\n", Compute(Number));
}
Output:
Result 9, 7, 5, 3, 1, Result: 25
Provides a read-only, forward-only rowset for fast sequential access to data.
Serialization: Converts object to stream of data for storage or transmission. Deserialization: Reconstructs object from data stream.
class MyNewClass : MyBaseClass { }
Number1 = 235, Number2 = 50;
Maximum = (Number1 < Number2) ? Number2 : Number1;
Result will be that Maximum = 235.
In C# variable parameters can be defined using the “params” Key word:
//Allows to pass in any number and any type of parameters
public static void Program(params object[] args){}
Note: Only one params keyword is permitted per method. If more than one parameter used then ‘params’ has to be the last parameter.
this refers to current object instance. Cannot be used in static methods.
DCOM uses RPC; default port 135 is Remote Procedure Call service for object communication.
.NET Remoting through marshalling.
| C# Question Answers-101 - 110 | C# Threading QA-1-10 | |