Zināšanu bāze

Izstrādātāja ikdiena, darbs ar Enum v2

Sveicināti!

Pavisam nesen biju iemusinājis kodu, kas ļauj viegli pārveidot virkni uz pārskaitījuma tipu (http://www.dotnet.lv/blogs/am/archive/2010/03/10/izstr-d-t-ja-ikdiena-darbs-ar-enum.aspx). Ar Microsoft .NET Framework 4.0 iznākšanu šis te kods pārveidots izmantojot jaunās iespējas.

    public static class Enum<T> where T : struct 
    {
        public static T Parse(string value)
        {
            T result;

            Enum.TryParse(value, out result)

            return result;
        }
    }

Ar .NET 4.0 ienākšanu Enum tipam parādījās statiska metode TryParse, kas atrisina visas problēmas ar virknes pārveidošanu uz pārskaitījumu. Palīg klase tagad kalpo tikai noklusētās vērtības atgriešanai, gadījumā ja neizdevās pārveidot uz norādīto pārskaitījuma tipu.

Cerams ka noderēs!


Posted Apr 20 2010, 06:41 PM by andrejs.mamontovs
Filed under: , , ,

Comments

Isabella wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 01-24-2012 12:49

There's a terrific amunot of knowledge in this article!

google+ hangouts wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 03-23-2012 9:06

PApahS Looking forward to reading more. Great blog post.Really thank you! Really Cool.

Article submission wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 08-09-2012 0:05

SSREMT Looking forward to reading more. Great blog post.Thanks Again. Really Great.

bookmarking service wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 10-08-2012 20:09

4qi1Cf Thanks again for the article.Thanks Again. Really Great.

crork wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 11-08-2012 5:48

nkHy6V Awesome article post.Really thank you! Will read on...

buy viagra wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 01-09-2013 18:20

h4H83E Enjoyed every bit of your blog.Much thanks again. Keep writing.

archeage power leveling wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 02-26-2013 10:43

Hello.This post was extremely remarkable, particularly because I was looking for thoughts on this issue last Friday. archeage power leveling www.cheap-archeage-gold.com/archeage-power-leveling.html

usine23 wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 03-23-2013 8:56

If you require an it of our truly worth, depend the children. usine23 http://e55.fr/

Social bookmarks wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 03-23-2013 15:37

F337AF Muchos Gracias for your blog.Really looking forward to read more. Will read on...

tee shirt pas cher wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 04-05-2013 9:02

Never lour, virtually all you may be upsetting, since can never predict who has dropping in love with a person's satisfaction. tee shirt pas cher http://www.i88.fr/

coach online outlet store wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 04-06-2013 20:59

Most likely Deity would like u . s . to get to know a few incorrectly men and women earlier than getting to know the most appropriate one, to be sure after we in conclusion satisfy the particular person, you will figure out how to be more glad. coach online outlet store www.coachoutletstore99.com

coachfactoryoutlet33.com wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 04-07-2013 5:38

Actual acquaintanceship foresees the needs of similar and not just laud it's always have.

coach factory outlet online wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 04-08-2013 7:02

An authentic associate is certainly one who else overlooks all of your lock-ups and therefore tolerates all of your achievements. coach factory outlet online www.coachoutletonline44.com

basketnike2013.com wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 04-12-2013 12:36

Do not socialize that happen to be contented to be with. Make friends which will trigger anyone to prize you moving upward. basketnike2013.com http://www.basketnike2013.com/

michael kors outlet wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 05-23-2013 21:16

thank you for share!

gucci outlet wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 06-03-2013 10:21

Check here

christian louboutin outlet wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 06-03-2013 14:58

Navigate To This Web-site

cheap sunglasses wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 06-06-2013 3:26

Have A Peek At THIS Web-Site

manolo blahnik wedding shoes wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 06-13-2013 9:02

Pop Over To These Guys

michaelkors-Will be your best choice 2012 wrote re: Izstrādātāja ikdiena, darbs ar Enum v2
on 06-16-2013 14:57

good articles

Add a Comment

(obligāts)  
(brīvizvēles)
(obligāts)  
Remember Me?