|
|
System.Guid.NewGuid.ToString.ToUpper
|
|
|
|
|
Yeah, I know, but the various parts of the serial may have special meaning. Since the OP didn't specify that, I thought I'd demonstrate that *anyone* can use google.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
|
So lets say I have Form1
in Form1 I want to build a reportviewer1 linked to an reportex.rdlc.
I have designed the rdlc and when the code executes it creates the dataset that is returned as dsCount
DataSet dsCount = ConvertDownloadAuditToDataSet(daCountList);
I want reportviewer1 to bind this dsCount to the report.
I know how to build on creating a xsd dataset but when I have an embedded dataset Im not sure how to bind it
|
|
|
|
|
Hi to all,
I want to know,
How to convert => A string of "char" into Text or Bytes information coded using (ISO/IEC 8859-x) character sets according to language used for string of "char" ? Language can be any regional or international.
Thanks & Regards,
Aniket A. Salunkhe
|
|
|
|
|
How about:
Encoding.GetEncoding("iso-8859-1").GetBytes("your-string");
Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.
|
|
|
|
|
Thank you very much for ur help.
I will try it.
I have to use character code tables ISO/IEC 8859-5 to ISO/IEC 8859-15 & few others (from Annex A.2 of 'Specification for Service Information (SI) in DVB systems' http://www.dvb.org/technology/standards/a038r6.tm1217r17.en300468v1.11.1.pdf[^].
Will it work with it?
Is there any way to identify character code table of a given string?
Thanks & Regards,
Aniket A. Salunkhe
|
|
|
|
|
|
|
1)
public List<string> GetList()
{
List<string> list = new List<string>();
return list;
}
But as per msdn we should not expose the generic list.
How to return a list from a method.
2)
Simillarly I have a method which has dictionary as a return type
How to return a dictionary from a method.
3) In my code I have craeted a dictionary as
Dictionary < int , Some Str> .
Now I need a colletion of keys avaialble in the dictionary.
How to do this.??
Do I need to retrive one by on from dictionary. ??
|
|
|
|
|
Hi,
1.
there is nothing that prevents you from returning a List (or any other collection) like that.
There may be "good practice" or "OO" reasons not to do so under certain circumstances, but it is perfect C#.
2.
see 1.
3.
if you look through the MSDN documentation, more particularly the properties of Dictionary<Tkey, Tvalue>, you will notice it is all there.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
FxCop will recommend using ReadOnlyCollection[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
That seems kind of inefficient. Does that mean there are now two copies of the same data in memory? (Actually, with their crappy sample, the array at the end of the Main() method makes a 3rd copy).
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Wednesday, June 9, 2010 1:50 PM
|
|
|
|
|
You're not supposed to actually read or use the examples
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
John Simmons / outlaw programmer wrote: Does that mean there are now two copies
No. The way I understand it the ReadOnlyThingy is just a wrapper; it holds a reference to the original collection (and that explains how it tracks the changes to the original collection, see the example), but offers fewer valid operations on that collection. So nothing gets copied.
I haven't used it ever yet, as I see not much point in making the collection read-only, while the items in the collection remain as they were, modifiable at will (except for the silly example that used strings of course).
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I use them quite a lot. Many times I want a collection to be exposed but not have add and remove methods etc as I don't want the collection itself to be modified. I find it very useful!
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
You're probably right, I still have to get used to them...
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Try using a custom iterator. Passing back a generic list is wasteful in some cases anyway.
public IEnumerable<String> GetStrings(){
foreach(var str in stringList){
yield return str;
}
}
"Simplicity carried to the extreme becomes elegance."
-Jon Franklin
|
|
|
|
|
You can do it that way (and IMHO, if the compiler lets you do it, nobody else has the right to complain, coding style guidelines in force not withstanding), but to ease typing, I create a class derived from the desired collection type:
public class ListOfThings : List<Thing>{}
That way, I can pass/return a ListOfThings object instead of having to type all that crap over and over again.
public ListOfThings GetListOfThings() { get; set; }
I can also add custom methods to the class that perform Thing -specific functionality.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: You can do it that way ...
But you end up actually typing MORE 'things':
ListOfThings
List<thing>
|
|
|
|
|
List<thing> - a little shorter
ListOfThings - a little eaiser to read
ThingsList - even shorter and still easier to read - WINNER!
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
It is code analysis that tells to return collections in stead of List. You can make use of a global suppression file in your code to get rid of it.
For dictionary, it would be suggesting a read only collection. Suppress that too if you do not want another object to be returned.
It is up to you to decide till when you are going to follow MS code analysis. I personally follow everything it tells.
|
|
|
|
|
Regarding Geneneric list as return type :
If you send/return the generic list outside, your collection can be very easily changed
from outside of your class without your permission and you lose total control on the same.
that is why , one should not expose or return generic list and use ReadOnlyCollection instead.
Dot net does not force you to do so but generally its not good programming practice!
Regarding point 2 :
Here also, A ReadOnlyCollection is recommanded.
Regarding point 3 :
You can create your customDictionary in which you can maintain and return the colelction of keys and/or
collection of values as per request.
|
|
|
|
|
Hi,
I have a web app that talks to a web service using binary remoting. I've been asked to change the solution so that the objects are transported in XML format to allow the data to be audited more easily and to prevent firewall problems.
I have read this article .NET Remoting with an easy example[^] which is great but I'm not clear on how to change my current binary implementation which use TcpClientChannels to a XML Marshal by Value solution.
Is this simple? If so, I would appreciate a work example if possible. Also is it going to provide the customer with what they want? How would you trace the XML objects while the application is running
Many Thanks for your time,
Andy
|
|
|
|