Wednesday, November 23, 2005
Wednesday, November 09, 2005
Wednesday, October 12, 2005
Tuesday, October 11, 2005
Monday, October 10, 2005
Friday, October 07, 2005
Wednesday, September 21, 2005
Saturday, September 17, 2005
Tuesday, September 13, 2005
Monday, September 12, 2005
Friday, September 09, 2005
Tuesday, September 06, 2005
Monday, September 05, 2005
Saturday, September 03, 2005
clone object in dotnet
private static void TestClone()
{
Person p1 = new Person();
p1.Age = 26;
p1.UserName = "yyanghhong";
Person p2 = (Person)CloneObjectEx(p1);
p2.UserName = "unruledboy";
Console.WriteLine(p1.UserName);
Console.WriteLine(p2.UserName);
}
public static Person CloneObject(Person ObjectInstance)
{
BinaryFormatter bFormatter = new BinaryFormatter();
MemoryStream stream = new MemoryStream();
bFormatter.Serialize(stream, ObjectInstance);
stream.Seek(0, SeekOrigin.Begin);
Person newObject = (Person)bFormatter.Deserialize(stream);
return newObject;
}
public static object CloneObjectEx(object ObjectInstance)
{
BinaryFormatter bFormatter = new BinaryFormatter();
MemoryStream stream = new MemoryStream();
bFormatter.Serialize(stream, ObjectInstance);
stream.Seek(0, SeekOrigin.Begin);
return bFormatter.Deserialize(stream);
}
[Serializable]
public class Person
{
private int age;
private string userName;
public Person()
{
}
public int Age
{
get{return age;}
set{age = value;}
}
public string UserName
{
get{return userName;}
set{userName = value;}
}
}
{
Person p1 = new Person();
p1.Age = 26;
p1.UserName = "yyanghhong";
Person p2 = (Person)CloneObjectEx(p1);
p2.UserName = "unruledboy";
Console.WriteLine(p1.UserName);
Console.WriteLine(p2.UserName);
}
public static Person CloneObject(Person ObjectInstance)
{
BinaryFormatter bFormatter = new BinaryFormatter();
MemoryStream stream = new MemoryStream();
bFormatter.Serialize(stream, ObjectInstance);
stream.Seek(0, SeekOrigin.Begin);
Person newObject = (Person)bFormatter.Deserialize(stream);
return newObject;
}
public static object CloneObjectEx(object ObjectInstance)
{
BinaryFormatter bFormatter = new BinaryFormatter();
MemoryStream stream = new MemoryStream();
bFormatter.Serialize(stream, ObjectInstance);
stream.Seek(0, SeekOrigin.Begin);
return bFormatter.Deserialize(stream);
}
[Serializable]
public class Person
{
private int age;
private string userName;
public Person()
{
}
public int Age
{
get{return age;}
set{age = value;}
}
public string UserName
{
get{return userName;}
set{userName = value;}
}
}
Friday, September 02, 2005
Wednesday, August 31, 2005
Saturday, August 27, 2005
Tuesday, August 23, 2005
Sunday, August 21, 2005
Monday, June 06, 2005
Tuesday, May 31, 2005
Thursday, May 26, 2005
Wednesday, May 25, 2005
Thursday, April 21, 2005
InternalsVisibleTo in c#2.0
It is a very useful attribute, especially good for unit test. but it will lead to some security issue, it is better to adopt strong name or add conditional constants to restrict it.
Tuesday, April 19, 2005
Thursday, April 07, 2005
Castle Active Record
Castle Active Record
this OR mapping framework is based on nhibernate, but it doen't require XML mapping file. it use attributes instead
this OR mapping framework is based on nhibernate, but it doen't require XML mapping file. it use attributes instead
Monday, March 28, 2005
Feature comparison between HA-JDBC and C-JDBC
Feature comparison between HA-JDBC and C-JDBC
A cheap method to implement database cluster(s) with multiple JVMs.
A cheap method to implement database cluster(s) with multiple JVMs.
Friday, March 25, 2005
Design for Performance vs. Tune for performance
Design for Performance vs. Tune for performance
There are some good points inside this article, I like using agile methods to deal with performance tuning, it requires a detailed unit testing case, and an agile way to amend the code, such as adopting AOP methods to put some business rules and logic into configuation file for ignoring re-compiling.
There are some good points inside this article, I like using agile methods to deal with performance tuning, it requires a detailed unit testing case, and an agile way to amend the code, such as adopting AOP methods to put some business rules and logic into configuation file for ignoring re-compiling.
Thursday, March 24, 2005
Tuesday, March 22, 2005
Wednesday, March 16, 2005
Tuesday, March 15, 2005
Mainsoft, Visual MainWin for the J2EE platform
Mainsoft, Visual MainWin for the J2EE platform
Visual MainWin brings the C# and Visual Basic .NET programming languages to the Java platform, enabling more than 2.5 million Microsoft-skilled developers to quickly and efficiently develop J2EE Web applications and Web services. it sounds too good to be true.
Visual MainWin brings the C# and Visual Basic .NET programming languages to the Java platform, enabling more than 2.5 million Microsoft-skilled developers to quickly and efficiently develop J2EE Web applications and Web services. it sounds too good to be true.
Monday, March 14, 2005
XenoCode 2005
XenoCode 2005
A good dotnet obfuscation tools, it supports a very nice feature of taking several assemblies and obfuscating them into one single assembly
A good dotnet obfuscation tools, it supports a very nice feature of taking several assemblies and obfuscating them into one single assembly
Saturday, March 12, 2005
Wednesday, March 09, 2005
Monday, March 07, 2005
Thursday, March 03, 2005
Monday, February 14, 2005
Sunday, February 13, 2005
Subscribe to:
Posts (Atom)