|
BillWoodruff wrote: why this particular string format representation of the Class' content is what you want. As far as I am told, these values of collections (like Value1,Value2,..) will be passed to an API through its URI. I can't argue with them or even think much about it at the moment as I am working on 3 projects in parallel...
I have found a solution, please see the replies below. Thanks anyway.
And yeah, I indeed need a good luck! Thanks for that..
Whether I think I can, or think I can't, I am always bloody right!
|
|
|
|
|
I appreciate you were not offended by my question; I was planning to delete this (second) post, feeling like it kind of violates some kind of ethic I can't quite define ... "Thou shalt not Nag" ?
I post "speculative" questions on CP, and, this is the language discussion forum; may we all enjoy the freedom to explore the "outer limits," and, how excellent that, in many cases ... including this one ... the result is valuable, and educational !
cheers, Bill
« I had therefore to remove knowledge, in order to make room for belief » Immanuel Kant
|
|
|
|
|
Just out of curiosity, what is the final purpose of this exercise?
That said, you could try this code inside
else if (property.PropertyType.Namespace.Contains(CollectionsNamespace) || property.PropertyType.IsArray)
{
object[] values = (object[])property.GetValue(data, null);
if (values != null)
{
foreach (object o in values)
{
Type t = o.GetType();
}
}
}
|
|
|
|
|
Sorry, but the cast to object[] doesn't work. I have found a solution, please see Eddy Vluggen's answer below. Thanks anyway
Whether I think I can, or think I can't, I am always bloody right!
|
|
|
|
|
Hopefully this may be of some use.
List<int>; d = new List<int>() { 1, 2, 3, 4, 5, 6 };
if (typeof(IList).IsAssignableFrom(d.GetType()) == true && d.GetType().IsGenericType == true)
{
IList x = d;
Type t = x.GetType().GetGenericArguments()[0];
foreach (object item in x)
{
switch (t.Name)
{
case "Int32":
int r = (int)item;
break;
default:
break;
}
}
}
My only part I wasn't sure of was casting the object back to type that was in the list, So I used a simple switch statement to do the hard work for me. Also apologies for the crap variable naming too.
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
Interesting! But I think I can simply cast the collection it to IEnumerable<object> and then simply .ToString() them in the final string, that should work, as I see the classes at the moment. Thank you very much!
Whether I think I can, or think I can't, I am always bloody right!
|
|
|
|
|
If it is an IEnumerable, then it can be iterated.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Told you that was a stupid question! But I wonder how I missed that.
Did a cast to IEnumerable<object> and it worked! Thank you very much!
Whether I think I can, or think I can't, I am always bloody right!
|
|
|
|
|
Hi Everyone .
how TCPServer can send file to client ??
but my question is i want to send file to client : but client is having some folder like Usr, Bin and etc.
but i want send file from server to client folder to "USR"
is it possible . if any knows please help me out
|
|
|
|
|
Usually clients actively fetch data from a server.
Do you want to push a file to a connected client?
|
|
|
|
|
yes. but client is having folder USER and BIN.
i want store file in to USER folder in client side.
|
|
|
|
|
|
That could be considered a malware approach! Do not do that.
|
|
|
|
|
The client decides where to store the file, you cannot control it from the server.
|
|
|
|
|
Hi all,
I have my html page. I put the correct and full path of images. As I run the page it's showing all images perfectly. But when I use this html code as a newsletter, all content is coming except images.
my images code is like below
<pre lang="HTML"> <img height="0" src="https://XXXXXXXXX/1410944453/bdb6c634e3/IUWM.jpg" style="max-width: 200px; width: 200px; height: auto !important;" width="200" /></pre>
|
|
|
|
|
Does this have anything to do with C#?
|
|
|
|
|
if mails comes through c# code? then?
|
|
|
|
|
Then show the code that is not working and explain why. All you have given us is a vague description of something not happening.
|
|
|
|
|
As Richard has stated this isn't a C# problem, but a Outlook problem. It all changed when they dropped internet explorer from rendering the HTML emails and swapped it to word.
I would have a read of this SO Question[^], the first answer shows you in code how to achieve it.
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
I like the feature of email clients *not* to automatically load content from the web. Normally the email client offers the possibility to load the external content on request - and I hardly ever do so. Why should I want to load tracking images in my email, or even worse: malware images which make use of vulnerabilities in graphics libraries?
|
|
|
|
|
hi,
how to read the actual content available in .SPL file which was generated by printer driver during the printing of any file using any open source dll in C#.net?
could you please provide me any suggestions to implement the above task?
thank you.
|
|
|
|
|
What does SPL mean in this context?
Samsung Printer Language?
|
|
|
|
|
windows spool file format, which was generated by printer driver at the time printing any file
|
|
|
|
|
The first thing you need to research is the format of the SPL files, or find a library that will decode it for you.
|
|
|
|
|
Well, to 'read' the file you could use some available viewer for SPL files: [^].
But, if you want to 'parse' the format yourself in code, use this reference as a starting point for the file format: [^].
I think parsing it yourself would be a huge task, because: you may have to deal with either EMF-SPL and Raw-SPL, and with Raw-SPL (from the link above):
In the case of RAW data, the content of the file is exactly the same as the data send to the printer ... So this data could be PCL, PostScript, ESC-P, CaPSL, Prescribe or similar.
« I had therefore to remove knowledge, in order to make room for belief » Immanuel Kant
|
|
|
|