[Mono-list] Debug Properties

Alexander Köplinger alkpli at microsoft.com
Fri Jan 13 12:18:49 UTC 2017


Hello,

that won't work since the string array just stores the string *values*, it doesn't know where they came from.
You could do it with a Dictionary, using the property name as the key e.g.:

> var dictionary = new Dictionary <string, string>() {
>     { "PublicationTitle", PublicationTitle },
>     { "PlaceOfAction", PlaceOfAction },
>     ...
> }
> 
> foreach (var entry in dictionary) {
>     Console.WriteLine(entry.Key + ": " + entry.Value);
> }

... but that is probably not any simpler than just doing a Console.WriteLine for each property manually ;-)

- Alex


> On 13 Jan 2017, at 12:37, Sascha Manns <Sascha.Manns at mailbox.org> wrote:
> 
> Hello List,
> 
> for debugging purposes i would like to read out, what content is stored actually in the Properties.
> 
> First i planned to do this so:
> 
> string
> [] collection = {PublicationTitle, PlaceOfAction, Firstname, Surname, Language};
> 
> foreach (var c in 
> collection)
> 
> {
> 
>     Console.Out.WriteLine(c);
> 
> }
> So i would like to use the Properties name and also its content. I would like to have a output similar to:
> 
> 1. Iteration: PublicationTitle: ContentOfPublicationTitle
> 2. Iteration: PlaceOfAction: ContentOfPlaceOfAction.
> 
> Can i realize that?
> 
> Greetings
> Sascha
> -- 
> Sascha Manns 
> Sascha.Manns at mailbox.org
> GPG: 0x168428cdb1f20ab1
> jabber: Sascha.Manns at jabber.org
> 
> 
> Maifeldstraße 10
> 56727 Mayen
> mobile: +49-1573-9242730
> home: +49-2651-4014045 
> https://saigkill.github.io
> 
> <twitter.png> <spacer.gif> <facebook.png> <spacer.gif> <linkedin.png> <spacer.gif> <skype.png> <spacer.gif> <github.png> <spacer.gif> <xing.png> <spacer.gif>
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.dot.net
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.dot.net%2Fmailman%2Flistinfo%2Fmono-list&data=02%7C01%7Calkpli%40microsoft.com%7C6f1ab88b717d414afa0f08d43ba84295%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636199041235562825&sdata=Cn4Mi89J3fRNfk2WDULXlxXxUZj3oEUZ7zj5Exz3OXc%3D&reserved=0



More information about the Mono-list mailing list