Click here to Skip to main content
15,920,438 members
Home / Discussions / C#
   

C#

 
GeneralInvertRegion Pin
mhmoud rawas5-Dec-03 22:09
mhmoud rawas5-Dec-03 22:09 
GeneralRe: InvertRegion Pin
Alex Korchemniy6-Dec-03 7:53
Alex Korchemniy6-Dec-03 7:53 
GeneralRe: InvertRegion Pin
mhmoud rawas6-Dec-03 8:40
mhmoud rawas6-Dec-03 8:40 
GeneralRe: InvertRegion Pin
J. Dunlap6-Dec-03 9:42
J. Dunlap6-Dec-03 9:42 
GeneralRe: InvertRegion Pin
mhmoud rawas6-Dec-03 18:00
mhmoud rawas6-Dec-03 18:00 
GeneralRe: InvertRegion Pin
J. Dunlap7-Dec-03 14:56
J. Dunlap7-Dec-03 14:56 
GeneralJPG Size Pin
mhmoud rawas5-Dec-03 22:07
mhmoud rawas5-Dec-03 22:07 
GeneralRe: JPG Size Pin
Heath Stewart6-Dec-03 4:57
protectorHeath Stewart6-Dec-03 4:57 
Not without performing the algorithm that would run on it, which you could to to an in-memory stream (MemoryStream) to determine the size.

BUT...

You can't save a binary stream to XML. You can use a number of different encodings but by far the most popular is base64. You don't need to know how big it'll be anyway, because you just perform the encoding and set the value on an XML element (or attribute, but data that large isn't really fit for attributes).

The XmlTextWriter class makes it easy to accomplish this using the XmlTextWriter.WriteBase64 method. The XmlTextReader.ReadBase64 does the opposite, of course.

Remember, though, that you don't need to allocate space in an XML file (unless you're doing some weird pre-empted packing routine). It's just a text file and like all text files will grow or shrink (within disk capacity) to accomodate the contents.

 

-----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: JPG Size Pin
Anonymous6-Dec-03 6:23
Anonymous6-Dec-03 6:23 
GeneralRe: JPG Size Pin
Heath Stewart6-Dec-03 6:44
protectorHeath Stewart6-Dec-03 6:44 
GeneralRe: JPG Size Pin
mhmoud rawas6-Dec-03 7:22
mhmoud rawas6-Dec-03 7:22 
GeneralRe: JPG Size Pin
mhmoud rawas6-Dec-03 7:24
mhmoud rawas6-Dec-03 7:24 
GeneralRe: JPG Size Pin
mhmoud rawas6-Dec-03 7:17
mhmoud rawas6-Dec-03 7:17 
GeneralFile Size over Internet Pin
eggie55-Dec-03 21:06
eggie55-Dec-03 21:06 
GeneralRe: File Size over Internet Pin
leppie5-Dec-03 21:51
leppie5-Dec-03 21:51 
GeneralRe: File Size over Internet Pin
Heath Stewart6-Dec-03 4:50
protectorHeath Stewart6-Dec-03 4:50 
GeneralRe: File Size over Internet Pin
eggie56-Dec-03 11:20
eggie56-Dec-03 11:20 
GeneralIdentifying the Web Server Pin
eggie55-Dec-03 15:07
eggie55-Dec-03 15:07 
GeneralRe: Identifying the Web Server Pin
eggie55-Dec-03 16:05
eggie55-Dec-03 16:05 
GeneralRe: Identifying the Web Server Pin
Heath Stewart6-Dec-03 4:49
protectorHeath Stewart6-Dec-03 4:49 
GeneralRe: Identifying the Web Server Pin
eggie56-Dec-03 5:54
eggie56-Dec-03 5:54 
GeneralRe: Identifying the Web Server Pin
Heath Stewart6-Dec-03 6:36
protectorHeath Stewart6-Dec-03 6:36 
GeneralRe: Identifying the Web Server Pin
eggie56-Dec-03 11:25
eggie56-Dec-03 11:25 
Generalmaking the computer restart after a setup program is finished Pin
blakeb_15-Dec-03 11:02
blakeb_15-Dec-03 11:02 
GeneralRe: making the computer restart after a setup program is finished Pin
Heath Stewart5-Dec-03 11:34
protectorHeath Stewart5-Dec-03 11:34 

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.