Click here to Skip to main content
15,892,768 members
Home / Discussions / C#
   

C#

 
GeneralDataGrid problem plz check Pin
Hayat4-Jan-04 20:52
Hayat4-Jan-04 20:52 
GeneralRe: DataGrid problem plz check Pin
Heath Stewart5-Jan-04 4:45
protectorHeath Stewart5-Jan-04 4:45 
GeneralRe: DataGrid problem plz check Pin
Hayat6-Jan-04 6:37
Hayat6-Jan-04 6:37 
GeneralRe: DataGrid problem plz check Pin
Heath Stewart6-Jan-04 6:41
protectorHeath Stewart6-Jan-04 6:41 
Generali'm a beginner. help Pin
Forrest Feather4-Jan-04 20:26
Forrest Feather4-Jan-04 20:26 
GeneralRe: i'm a beginner. help Pin
Broken God4-Jan-04 22:16
Broken God4-Jan-04 22:16 
GeneralRe: i'm a beginner. help Pin
extremeg6-Jan-04 20:46
extremeg6-Jan-04 20:46 
GeneralRe: i'm a beginner. help Pin
Forrest Feather6-Jan-04 22:11
Forrest Feather6-Jan-04 22:11 
GeneralMAP files Pin
abc8764-Jan-04 20:17
abc8764-Jan-04 20:17 
GeneralRe: MAP files Pin
Heath Stewart5-Jan-04 4:41
protectorHeath Stewart5-Jan-04 4:41 
Generalcustom controls and video Pin
just_a_builder4-Jan-04 20:03
just_a_builder4-Jan-04 20:03 
GeneralRe: custom controls and video Pin
Heath Stewart5-Jan-04 4:13
protectorHeath Stewart5-Jan-04 4:13 
GeneralREAD/WRITE SECTORS, TRACKS, ECC... Pin
_Comet_Keeper_4-Jan-04 13:11
_Comet_Keeper_4-Jan-04 13:11 
GeneralRe: READ/WRITE SECTORS, TRACKS, ECC... Pin
Heath Stewart4-Jan-04 19:01
protectorHeath Stewart4-Jan-04 19:01 
GeneralOne Line Pin
eggie54-Jan-04 12:29
eggie54-Jan-04 12:29 
GeneralRe: One Line Pin
Christian Graus4-Jan-04 12:58
protectorChristian Graus4-Jan-04 12:58 
GeneralRe: One Line Pin
eggie54-Jan-04 13:01
eggie54-Jan-04 13:01 
GeneralRe: One Line Pin
Christian Graus4-Jan-04 13:06
protectorChristian Graus4-Jan-04 13:06 
GeneralRe: One Line Pin
eggie54-Jan-04 13:42
eggie54-Jan-04 13:42 
GeneralRe: One Line Pin
Heath Stewart4-Jan-04 18:51
protectorHeath Stewart4-Jan-04 18:51 
GeneralRe: One Line Pin
eggie55-Jan-04 11:51
eggie55-Jan-04 11:51 
QuestionDateTime Property, custom TypeConverter for XmlSerialisation ? Pin
Chris Richner4-Jan-04 11:56
Chris Richner4-Jan-04 11:56 
AnswerRe: DateTime Property, custom TypeConverter for XmlSerialisation ? Pin
Heath Stewart4-Jan-04 18:46
protectorHeath Stewart4-Jan-04 18:46 
XML serialization doesn't make use of a TypeConverter. It is hard-coded to format the intrinsic types and several common types like a DateTime. You could instead implement the IXmlSerializable interface. Though it's undocumented, it's pretty easy to figure out. Otherwise, you could create your own XmlSerializationReader and XmlSerializationWriter, but both are also undocumented and very complex. I'd recommend implementing IXmlSerializable on your class that contains the DateTime you want to format differently.

Also, you could always have a public property that returns and accepts a string in the format you want. You could use XmlIgnoreAttribute on the actual DateTime proeprty while using the value from the string property:
[XmlRoot("example")]
public class Example
{
  // ...
  [XmlIgnore]
  public DateTime DT
  {
    get { return this.dt; }
    set { this.dt = value; }
  }

  [XmlElement("dt")]
  public string DTFormat
  {
    get { return this.dt.ToString("r"); }
    set { this.dt = DateTime.Parse(value); }
  }
}
Note, using the format specifier "r" in DateTime.ToString says that it outputs a date-time in RFC 1123, but this RFC is not found the the format looks the same. Use a custom format if I am wrong.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: DateTime Property, custom TypeConverter for XmlSerialisation ? Pin
Chris Richner4-Jan-04 20:11
Chris Richner4-Jan-04 20:11 
GeneralRe: DateTime Property, custom TypeConverter for XmlSerialisation ? Pin
Heath Stewart5-Jan-04 4:03
protectorHeath Stewart5-Jan-04 4:03 

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.