Click here to Skip to main content
14,333,747 members
   

C#

 
AnswerRe: Why is the dataGridView1_SortCompare function not working ? Pin
Member 24584679-Oct-19 15:20
memberMember 24584679-Oct-19 15:20 
GeneralRe: Why is the dataGridView1_SortCompare function not working ? Pin
Richard MacCutchan9-Oct-19 21:38
protectorRichard MacCutchan9-Oct-19 21:38 
GeneralRe: Why is the dataGridView1_SortCompare function not working ? Pin
Member 245846710-Oct-19 18:17
memberMember 245846710-Oct-19 18:17 
GeneralRe: Why is the dataGridView1_SortCompare function not working ? Pin
Richard MacCutchan10-Oct-19 22:03
protectorRichard MacCutchan10-Oct-19 22:03 
GeneralRe: Why is the dataGridView1_SortCompare function not working ? Pin
Member 245846714-Oct-19 20:52
memberMember 245846714-Oct-19 20:52 
GeneralRe: Why is the dataGridView1_SortCompare function not working ? Pin
Richard MacCutchan14-Oct-19 22:00
protectorRichard MacCutchan14-Oct-19 22:00 
GeneralRe: Why is the dataGridView1_SortCompare function not working ? Pin
Member 245846717-Oct-19 17:21
memberMember 245846717-Oct-19 17:21 
Questionunexpected behavior of DataContract serializer: C# language issue Pin
BillWoodruff8-Oct-19 8:07
mveBillWoodruff8-Oct-19 8:07 
Using the DataContract serialize/deserialize facilities in System.Runtime.Serialization is very convenient, reliable. It does produce verbose xml with rather stunningly long labels like:
</KeyValueOfPersonLikeIntensityvlZcIX2K></Value></KeyValueOfPersonArrayOfKeyValueOfPersonLikeIntensityvlZcIX2Kg_S_SinKSu></ArrayOfKeyValueOfPersonArrayOfKeyValueOfPersonLikeIntensityvlZcIX2Kg_S_SinKSu>
That's serialized output from a graph engine I am writing. However, by using GZip you can compress that by factors of #20, or more.

It is interesting to observe that if a Class inherits from a generic structure, like:
[DataContract]
public Class Graph<TVertex, TEdge> : Dictionary<TVertex, Dictionary<TVertex, TEdge>>
That will fail to serialize; however, by removing the 'DataContract Attribute, and adding the 'Serializable Attribute, it will serialize properly using a 'DataContractSerializer. This works:
[Serializable]
public Class Graph<TVertex, TEdge> : Dictionary<TVertex, Dictionary<TVertex, TEdge>>
And, you can, of course still have the Class as generic, and make an internal field/property of the necessary Type marked with the 'DataMember Attribute:
[DataContract]
public Class Graph<TVertex, TEdge>
{
     [DataMember]
     public Dictionary<TVertex, Dictionary<TVertex, TEdge>> GraphDict { set; get; }
}
I haven't seen any documentation on this, but the error message is what suggested trying to replace 'DataContract with 'Serializable:
System.Runtime.Serialization.InvalidDataContractException
  HResult=0x80131500
  Message=Type 'Graph_2019_2.PersonLikeGraph' cannot be ISerializable and have DataContractAttribute attribute.
So, you be the judge: hack, or useful information ? Anomalous but reliable, or, anomalous and unreliable ?

Note: while the observations I cite are all based on FW 4.8: the behavior described has been encountered with many previous FW versions.
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali


modified 8-Oct-19 14:17pm.

AnswerRe: unexpected behavior of DataContract serializer: C# language issue Pin
Eddy Vluggen8-Oct-19 8:52
mveEddy Vluggen8-Oct-19 8:52 
AnswerRe: unexpected behavior of DataContract serializer: C# language issue Pin
Richard Deeming8-Oct-19 8:59
mveRichard Deeming8-Oct-19 8:59 
GeneralRe: unexpected behavior of DataContract serializer: C# language issue Pin
BillWoodruff8-Oct-19 12:50
mveBillWoodruff8-Oct-19 12:50 
QuestionHelp to get only IPv4 address Pin
mniceguy818-Oct-19 7:14
membermniceguy818-Oct-19 7:14 
AnswerRe: Help to get only IPv4 address Pin
Richard MacCutchan8-Oct-19 8:02
protectorRichard MacCutchan8-Oct-19 8:02 
AnswerRe: Help to get only IPv4 address Pin
Richard Deeming8-Oct-19 8:54
mveRichard Deeming8-Oct-19 8:54 
GeneralRe: Help to get only IPv4 address Pin
mniceguy819-Oct-19 3:51
membermniceguy819-Oct-19 3:51 
GeneralRe: Help to get only IPv4 address Pin
Richard Deeming9-Oct-19 7:36
mveRichard Deeming9-Oct-19 7:36 
GeneralRe: Help to get only IPv4 address Pin
mniceguy819-Oct-19 7:41
membermniceguy819-Oct-19 7:41 
QuestionDoes the Visual studio C#.net have a progressBar and a control line ? Pin
Member 24584676-Oct-19 23:34
memberMember 24584676-Oct-19 23:34 
AnswerRe: Does the Visual studio C#.net have a progressBar and a control line ? Pin
Afzaal Ahmad Zeeshan6-Oct-19 23:44
mveAfzaal Ahmad Zeeshan6-Oct-19 23:44 
GeneralRe: Does the Visual studio C#.net have a progressBar and a control line ? Pin
Member 24584677-Oct-19 16:41
memberMember 24584677-Oct-19 16:41 
QuestionDrawing from a Class library to a pictureBox Pin
Ali Zigon6-Oct-19 5:27
memberAli Zigon6-Oct-19 5:27 
AnswerRe: Drawing from a Class library to a pictureBox Pin
Richard MacCutchan6-Oct-19 5:48
protectorRichard MacCutchan6-Oct-19 5:48 
GeneralRe: Drawing from a Class library to a pictureBox Pin
Ali Zigon6-Oct-19 6:19
memberAli Zigon6-Oct-19 6:19 
GeneralRe: Drawing from a Class library to a pictureBox Pin
Richard MacCutchan6-Oct-19 7:08
protectorRichard MacCutchan6-Oct-19 7:08 
GeneralRe: Drawing from a Class library to a pictureBox Pin
Ali Zigon6-Oct-19 8:37
memberAli Zigon6-Oct-19 8:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.