Sample.txt 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. namespace WindowsApplicationProve
  2. {
  3. namespace Cxxx
  4. {
  5. [Serializable]
  6. public struct OtherStruct
  7. {
  8. public int FInt;
  9. }
  10. [Serializable]
  11. public struct StructSample
  12. {
  13. public int FInt;
  14. public char FChar;
  15. public object FObj;
  16. }
  17. [Serializable]
  18. public enum EnumSample
  19. {
  20. aa,
  21. bb,
  22. cc
  23. }
  24. [Serializable]
  25. public delegate int DelegateProve(int i);
  26. [Serializable]
  27. public delegate void OtherDelegate();
  28. public interface ISample
  29. {
  30. int FirstMethod(char charParam);
  31. }
  32. [Serializable]
  33. public class cIntProve: ISample
  34. {
  35. public long FLongField;
  36. public int FirstMethod(char charParam)
  37. {
  38. return 6;
  39. }
  40. }
  41. public delegate string DlgProve(int i);
  42. [Serializable]
  43. public class cAgregationClass:BaseClass
  44. {
  45. public Char FCharField;
  46. public string FStr;
  47. public cSerializableProve Fobj;
  48. public ISample Fintf;
  49. //public int[][] FIntList;
  50. public string DlgCatcher(int i)
  51. {
  52. return "Hello";
  53. }
  54. }
  55. [Serializable]
  56. public class BaseClass
  57. {
  58. public int FBaseint;
  59. public cIntProve FIntObj;
  60. }
  61. [Serializable]
  62. public class cXXX
  63. {
  64. public int FI;
  65. }
  66. [Serializable]
  67. public class cSerializableProve
  68. {
  69. public object[] FArrayProve;
  70. public object[] FNullArray;
  71. //public ClassProve FOtherAssObj;
  72. public cAgregationClass FAggField;
  73. //value types
  74. public DelegateProve FDelegateProve;
  75. public event OtherDelegate FEventField;
  76. public ISample FInterfaceField;
  77. public string FStrField;
  78. private int FPintField;
  79. public int FIntField;
  80. public uint FUintField;
  81. public short FShortField;
  82. public ushort FUShortField;
  83. public long FLongField;
  84. public ulong FULongField;
  85. public bool FBoolField;
  86. public double FDoubleField;
  87. public decimal FDecimalField;
  88. public char FCharField;
  89. public StructSample FStructField;
  90. public EnumSample FEnumField;
  91. public cSerializableProve()
  92. {
  93. InitReferences();
  94. InitSimpleTypes();
  95. InitStructs();
  96. InitArray();
  97. }
  98. private void InitReferences()
  99. {
  100. FAggField = new cAgregationClass();
  101. FAggField.FCharField = 'a';
  102. FAggField.FBaseint = 10;
  103. FAggField.Fobj= this;
  104. FAggField.FStr= "Hhhh";
  105. FStrField= FAggField.FStr;
  106. FAggField.FIntObj= new cIntProve ();
  107. FInterfaceField= FAggField.FIntObj;
  108. FAggField.Fintf= FInterfaceField;
  109. }
  110. private void InitSimpleTypes()
  111. {
  112. FArrayProve= new Object[20];
  113. FPintField= 10;
  114. FIntField = 6;
  115. FUintField = 6;
  116. FShortField = 6;
  117. FUShortField = 6;
  118. FLongField = 6;
  119. FULongField = 6;
  120. FDoubleField = 6;
  121. FDecimalField = 5;
  122. FBoolField = true;
  123. FCharField = 'a';
  124. FEnumField = EnumSample.aa;
  125. }
  126. private void InitStructs()
  127. {
  128. FStructField= new StructSample();
  129. FStructField.FChar= 'a';
  130. FStructField.FInt= 10;
  131. FStructField.FObj= this.FAggField;
  132. }
  133. private void InitArray()
  134. {
  135. FArrayProve[0]= new cAgregationClass();
  136. ((cAgregationClass)FArrayProve[0]).FStr= "Hello";
  137. FArrayProve[1]= new cAgregationClass[2];
  138. ((cAgregationClass[])FArrayProve[1])[0]= this.FAggField;
  139. FArrayProve[2]= new int[][][]{new int[][]{new int[3], new int[3], new int[3]}, new int[][]{new int[3], new int[3], new int[3]}};
  140. /*Fill the integer array*/
  141. ((int[][][])FArrayProve[2])[1][1][1]= 10;
  142. ((int[][][])FArrayProve[2])[1][1][2]= 10;
  143. ((int[][][])FArrayProve[2])[1][1][0]= 10;
  144. FArrayProve[3]= new OtherStruct();
  145. FArrayProve[4]= 6;
  146. FArrayProve[5]= true;
  147. FArrayProve[6]= 2.5;
  148. FArrayProve[7]= EnumSample.bb;
  149. FArrayProve[8]= this.FInterfaceField;
  150. FArrayProve[9]= "Hello";
  151. FArrayProve[10]= new UInt32();
  152. FArrayProve[11]= new short();
  153. FArrayProve[12]= new UInt16();
  154. FArrayProve[13]= new decimal();
  155. FArrayProve[15]= new ulong();
  156. FArrayProve[16]= new char();
  157. FArrayProve[18]= null;
  158. }
  159. public void InitDelegates()
  160. {
  161. FDelegateProve= new DelegateProve(SIntProve);
  162. FEventField= new OtherDelegate(OtherProve);
  163. }