Feeds:
Posts
Comments

Archive for the ‘C#.NET’ Category

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[] [...]

Read Full Post »

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 [...]

Read Full Post »

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 [...]

Read Full Post »

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.

Read Full Post »

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 [...]

Read Full Post »

Transaction in C#.NET

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 [...]

Read Full Post »

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.

Read Full Post »

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() [...]

Read Full Post »

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 [...]

Read Full Post »

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 [...]

Read Full Post »

Older Posts »

Follow

Get every new post delivered to your Inbox.