安装魔兽世界糟了好像像Circle-Cast这样的...

!!! Popular Now !!!
Title: ?? : ??? ? ?? / Circle
Chinese Title: Circle:相?的??世界
Also known as: Circle: Two Connected Worlds
Genre: Sci-fi, Mystery
Broadcast network:
Episodes: 12
Broadcast period: 2017-May-22 to 2017-June-27
Air time: Mondays & Tuesdays 23:00
Set in the present (2017) and the future (2037), the story is about an alien invasion in 2017 and the subsequent new Earth in 2037; which is separated into the “Smart Earth” where people’s emotions are controlled and no crimes and illness exist, and the “General Earth” where people still suffer from rampant plague and lawlessness.
as Kim Woo Jin (Beta Project)
as Kim Woo Jin (child)
as Kim Joon Hyuk (Brave New World)
as Han Jung Yun (Beta Project)
as Lee Ho Soo (Brave New World)
as Kim Bum Kyoon (Beta Project)
as Kim Bum Kyoon (child)
as Park Min Young (Beta Project)
People around Woo Jin (Beta Project)
as Hong Jin Hong
as Lee Dong Soo
as Dong Soo (Child)
as Detective Choi
as Kim Gyu Chul
Handam University people (Beta Project)
as Han Yong Woo
as Park Dong Gun
as Sunbae Lee
General District people (Brave New World)
as Hong Jin Hong
as Lee Dong Soo
as Doctor Park
as Detective Oh
Smart District people (Brave New World)
as Lee Hyun Suk
as Yoon Hak Joo
as Secretary Shin
as Kim Min Ji
as Bluebird
as entourage
Production Credits
Production Company: tvN, Studio Dragon, KPJ
Production Planner: Lee Myung Han
Chief Producer: Park Sung Jae
Producers: Choi Jin Hee, Jang Jin Wook
Director: Min Jin Ki
Assistant Directors: Jun Min Ho, Noh Jung Hoon, Park Hyung Won, Wi Seung Yun, Kim Geum Nan
Editors: Na Hee Soo, Jun Mi Sook
Cinematographers: Choi Sung Tae, Park Sung Young
Music Director: Kim Soo Jin
Screenwriters: Ryu Moon Sang, Kim Jin Hee, Yoo Hye Mi, Park Eun Mi
Episode Ratings
Sources: TNmS Media Korea & AGB Nielsen Korea (Nationwide)
*** Different between TNmS Media Korea & AGB Nielson –
*** Note: This drama is aired on Pay-TV channel which has fewer viewers than Free-TV channels. So, please don’t be surprised with the low rating. ***
Related Photo
Leave a Reply
Follow us on
Upcoming Drama
Ongoing Drama
Recently Completed Drama / Completed Soon
Browse Drama By Year
Browse By Year2: public abstract class Shape { }
4: // a basic rectangle
5: public class Rectangle : Shape
public int Widtgh { }
public int Height { }
And let’s assume we have a sequence of Shape where every Shape is a Rectangle…
1: var shapes = new List&Shape&
new Rectangle { Width = 3, Height = 5 },
new Rectangle { Width = 10, Height = 13 },
To get the sequence of Shape as a sequence of Rectangle, of course, we could use a Select() clause, such as:
1: // select each Shape, cast it to Rectangle
2: var rectangles = shapes
.Select(s =& (Rectangle)s)
.ToList();
But that’s a bit verbose, and fortunately there is already a facility built in and ready to use in the form of the Cast&TResult&() extension method:
1: // cast each item to Rectangle and store in a List&Rectangle&
2: var rectangles = shapes
.Cast&Rectangle&()
.ToList();
However, we should note that if anything in the list cannot be cast to a Rectangle, you will get an InvalidCastException thrown at runtime.
Thus, if our Shape sequence had a Circle in it, the call to Cast&Rectangle&() would have failed.
As such, you should only do this when you are reasonably sure of what the sequence actually contains (or are willing to handle an exception if you’re wrong).
Another handy use of Cast&TResult&() is using it to convert an IEnumerable to an IEnumerable&T&.
If you look at the signature, you’ll see that the Cast&TResult&() extension method actually extends the older, object-based IEnumerable interface instead of the newer, generic IEnumerable&T&.
This is your gateway method for being able to use LINQ on older, non-generic sequences.
For example, consider the following:
1: // the older, non-generic collections are sequence of object
2: var shapes = new ArrayList
new Rectangle { Width = 3, Height = 13 },
new Rectangle { Width = 10, Height = 20 },
Since this is an older, object based collection, we cannot use the LINQ extension methods on it directly.
For example, if I wanted to query the Shape sequence for only those Rectangles whose Width is & 5, I can’t do this:
1: // compiler error, Where() operates on IEnumerable&T&, not IEnumerable
2: var bigRectangles = shapes.Where(r =& r.Width & 5);
However, I can use Cast&Rectangle&() to treat my ArrayList as an IEnumerable&Rectangle& and then do the query!
1: // ah, that’s better!
2: var bigRectangles = shapes.Cast&Rectangle&().Where(r =& r.Width & 5);
Or, if you prefer, in LINQ query expression syntax:
1: var bigRectangles = from s in shapes.Cast&Rectangle&()
where s.Width & 5
One quick warning: Cast&TResult&() only attempts to cast, it won’t perform a cast conversion.
That is, consider this:
1: var intList = new List&int& { 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 };
3: // casting ints to longs, this should work, right?
4: var asLong = intList.Cast&long&().ToList();
Will the code above work?
No, you’ll get a InvalidCastException. Remember that Cast&TResult&() is an extension of IEnumerable, thus it is a sequence of object, which means that it will box every int as an object as it enumerates over it, and there is no cast conversion from object to long, and thus the cast fails.
In other words, a cast from int to long will succeed because there is a conversion from int to long.
But a cast from int to object to long will not, because you can only unbox an item by casting it to its exact type.
For more information on why cast-converting boxed values doesn’t work, see this post on
OfType&TResult&() - Filter sequence to only items of type TResult
So, we’ve seen how we can use Cast&TResult&() to change the type of our sequence, when we expect all the items of the sequence to be of a specific type.
But what do we do when a sequence contains many different types, and we are only concerned with a subset of a given type?
For example, what if a sequence of Shape contains Rectangle and Circle instances, and we just want to select all of the Rectangle instances?
Well, let’s say we had this sequence of Shape:
1: var shapes = new List&Shape&
new Rectangle { Width = 3, Height = 5 },
new Rectangle { Width = 10, Height = 13 },
new Circle { Radius = 10 },
new Square { Side = 13 },
Well, we could get the rectangles using Select(), like:
1: var onlyRectangles = shapes.Where(s =& s is Rectangle).ToList();
But fortunately, an easier way has already been written for us in the form of the OfType&T&() extension method:
1: // returns only a sequence of the shapes that are Rectangles
2: var onlyRectangles = shapes.OfType&Rectangle&().ToList();
Now we have a sequence of only the Rectangles in the original sequence, we can also use this to chain other queries that depend on Rectangles, such as:
1: // select only Rectangles, then filter to only those more than
2: // 5 units wide...
3: var onlyBigRectangles = shapes.OfType&Rectangle&()
.Where(r =& r.Width & 5)
.ToList();
The OfType&Rectangle&() will filter the sequence to only the items that are of type Rectangle (or a subclass of it), and that results in an IEnumerable&Rectangle&, we can then apply the other LINQ extension methods to query that list further.
Just as Cast&TResult&() is an extension method on IEnumerable (and not IEnumerable&T&), the same is true for OfType&T&().
This means that you can use OfType&TResult&() on object-based collections as well.
For example, given an ArrayList containing Shapes, as below:
1: // object-based collections are a sequence of object
2: var shapes = new ArrayList
new Rectangle { Width = 3, Height = 5 },
new Rectangle { Width = 10, Height = 13 },
new Circle { Radius = 10 },
new Square { Side = 13 },
We can use OfType&Rectangle& to filter the sequence to only Rectangle items (and subclasses), and then chain other LINQ expressions, since we will then be of type IEnumerable&Rectangle&:
1: // OfType() converts the sequence of object to a new sequence
2: // containing only Rectangle or sub-types of Rectangle.
3: var onlyBigRectangles = shapes.OfType&Rectangle&()
.Where(r =& r.Width & 5)
.ToList();
So now we’ve seen two different ways to get a sequence of a superclass or interface down to a more specific sequence of a subclass or implementation.
The Cast&TResult&() method casts every item in the source sequence to type TResult, and the OfType&TResult&() method selects only those items in the source sequence that are of type TResult.
You can use these to downcast sequences, or adapt older types and sequences that only implement IEnumerable (such as DataTable, ArrayList, etc.).
Technorati Tags: ,,,,,,,
Share This Post:&&Short Url:
&re: C#/.NET Little Wonders: Use Cast() and OfType() to Change Sequence Type
You also gave the example Rectangle class a "Widtgh" Property instead of Width.The wealth of capability that LINQ's extension methods can be overwhelming, and your "Little wonders" posts on the subject are a good way to absorb the possibilities in managable chunks :)
&re: C#/.NET Little Wonders: Use Cast() and OfType() to Change Sequence Type
@BC_Programmer: DOH!
I'll have to fix that "Widtgh" typo...
&re: C#/.NET Little Wonders: Use Cast() and OfType() to Change Sequence Type
Thank you for this, just had the cast issue before I stopped for lunch so this has come at a perfect time for me :)
&re: C#/.NET Little Wonders: Use Cast() and OfType() to Change Sequence Type
One small thing:var onlyRectangles = shapes.Where(s =& s is Rectangle).ToList();is still a sequence of Shape objects (yet only containing objects assignable Rectangle).
&re: C#/.NET Little Wonders: Use Cast() and OfType() to Change Sequence Type
@RaphM: Doh!
Yes, I had forgotten an important clause:var onlyRectangles = shapes.Where(s =& s is Rectangle).Select(s =& (Rectangle) s).ToList();Or, alternatively:var onlyRectangles = shapes.Select(s =& s as Rectangle).Where(r =& r != null).ToList();
&re: C#/.NET Little Wonders: Use Cast() and OfType() to Change Sequence Type
why can't Select be found?
var shapes = new List&Shape&
new Rectangle { Width = 3, Height = 5 },
new Rectangle { Width = 10, Height = 13 },
new Ellipse { Height=20, Width=20 },
new Line { X1 = 3,X2=3,Y1=1, Y2=3
var onlyRectangles = shapes.Select(s =& s as Rectangle).Where(r =& r != null).ToList();

参考资料

 

随机推荐