using System; using System.Collections.Generic; using System.Text; using System.Reflection; using System.Web; using System.IO; using System.Net; namespace ConsoleExample { class LoadAssembly { public void LoadAssembly_FromFile() { Assembly Ass = System.Reflection.Assembly.LoadFrom(“D:\\Parthiban\\ConsoleExample\\CrystalDecisions.Shared.dll”); Type Asstype = Ass.GetType(); #region Get Constructor Info ConstructorInfo[] I = Asstype.GetConstructors(); #endregion #region Extractiong Properties Info PropertyInfo[] PrInfo = Asstype.GetProperties(); #endregion #region Extracting Method Info MethodInfo[] [...]
Archive for the ‘C#.NET’ Category
To Read a Assembly file using Reflection in C#.NET
Posted in C#.NET on July 20, 2008 | Leave a Comment »
Passing Object Reference to a Function
Posted in C#.NET on July 20, 2008 | Leave a Comment »
While Passing reference to the function any changes made to that variables inside the Function.That will affect the Main variable value. —————————————– When we can Pass it object value as variables it just make a Copy of that variables…… and than it takes to perform an operation.But while passing the reference Both variables are refer [...]
Overloaded Constructor in C#.NET
Posted in C#.NET on July 20, 2008 | Leave a Comment »
A class can have any number of constructor. OverloadConstructor is nothing but the Constructor having different set of parameters. 1.Under this type of situation ,how to call one Constructor to another constructor. For the below Example when creating Object to the Parameter 2 Constructor it automatically redire -ct to the Parameter 3 Constructor.The Parameter 2 [...]
To Call a Base Class Constructor From Derived Class Constructor Calling in C#.NET
Posted in C#.NET on July 20, 2008 | Leave a Comment »
class CheckStatic:NewKeyWord { public CheckStatic():base() { Console.WriteLine(“I am a Derived Class Constructor”); } public void CheckStatic1() { base.GetData1(); } } /////////////////////////////////////////// Use the (Base) Keyword to call a Base Class Constructor.
Basic 64-bit Encoding and Decoding in C#.NET
Posted in C#.NET on July 20, 2008 | Leave a Comment »
byte[] Keybyte = new byte[Key.Length]; System.Text.ASCIIEncoding Encoding = new System.Text.ASCIIEncoding(); return Convert.ToBase64String(Encoding.GetBytes(Key) ); ///// U can also use it to convert string to Bytes. Short Method: string OrderCode = “Ord12011982″; #region Encode byte[] Enc = ASCIIEncoding.UTF7.GetBytes(OrderCode); string EncString = Convert.ToBase64String(Enc); #endregion #region Decode byte[] Dec = Convert.FromBase64String(EncString); string b = ASCIIEncoding.UTF7.GetString(Dec); #endregion Tou can al [...]
Transaction in C#.NET
Posted in C#.NET on July 20, 2008 | Leave a Comment »
SqlConnection conn = new SqlConnection(connString); SqlTransaction trans = conn.BeginTransaction(); try { SqlCommand cmd = new SqlCommand(“MyWriteProc”,conn, trans); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(…. … // additional transactioned writes to database trans.Commit(); } catch { trans.Rollback(); } When you use ADO.NET manual transactions, you can set the desired isolation level on the BeginTransacion method as shown in the [...]
Using Block inside the void Main in c#.NET,ASP.NET
Posted in ASP.NET, C#.NET on July 20, 2008 | Leave a Comment »
We can’t able to use the using block inside the public static void main(String args[]) { using (ReadingFile Rf = new ReadingFile()) { Rf.ReadFile(); } } Like the above usage.Because the System.IDisposible implisitely called inside the static void main(String args[]) function.
Inner Class,Creating an Instance Of the Class
Posted in ASP.NET, C#.NET on July 20, 2008 | Leave a Comment »
using System; using System.Collections.Generic; using System.Text; namespace ConsoleExample { public class OuterClass { public void OuterClassFunction() { Console.WriteLine(“I am in Outer Class Function”); } //Reinitialize the class public InnerClass abc() { return new InnerClass(); } public class InnerClass { public OuterClass OutC() { return new OuterClass(); } public string PublicInner; private string privateInner; public InnerClass() [...]
Variable Passing in C#.Net
Posted in ASP.NET, C#.NET on July 20, 2008 | Leave a Comment »
class PropertiesExplaination { void OrdinaryAccessMethod(params int[] Params) { Console.WriteLine(Params.Length); } static void Main(string[] args) { PropertiesExplaination Obj = new PropertiesExplaination(); Obj.a = 1; Obj.OrdinaryAccessMethod(Obj.a,Obj.a+1,Obj.a+3); Console.Read(); } } For the above Example PropertiesExplaination is a Class Name and OrdinaryAccessMethod is a sample method. params-> is a Keyword to Pass a Array of Variables. For the above [...]
NameValueCollection in C#.NET
Posted in C#.NET on July 20, 2008 | Leave a Comment »
The name value collection is same like the HashTable. We can set the Object value and the Key to that particuar Object. But the HashTable dont allow theduplicate keyws. But the NameValueCollection alloes duplicate Keys. as well as it’s provide the fast way of access to it. Example HashTable:(It’a raise an error because of the [...]