Can someone please explain why all of the methods in the DbContext class look like they are abstract methods in an abstract class or methods in an interface. If these are concrete methods why don't they have implementations?
You're looking at the peek definition window. It shows the definition for the type or method symbol your cursor is currently on. It can not show implementation code it doesn't have access to like in an external DLL. In that case it only displays metadata.
hello Friend i have to know how to split below stringin particular part. i have find this type of stringin bar-code scanner as a input
I have a input
Hide Copy Code
and i want output
please help me to solve this.
So you're looking at positional indexing. In other words, get the string from position 0 to 4 then 5 to 8 and so on. The string class has many features that could make this life easier for you but, if I were you, I would look at the Substring[^] command.
This is not a good question - we cannot work out from that little what you are trying to do. Remember that we can't see your screen, access your HDD, or read your mind. So why would you want to disable the keyboard when the system is idle, given that the system will only become "busy" again in response to events - one of which is the user typing on the keyboard?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
Expression<Func<T, TResult>> represents a strongly-typed expression tree of a lambda or function. Expression trees represent expressions like a < b stored in a tree structure. So what are they used for? Well, that's open to your imagination honestly. A common scenario is if you want to modify a code expression based on some currently unknown or later business logic. Since an expression tree is a data representation of a code expression you're free to modify it before calling Compile() and executing it. This is essential for LINQ-to-SQL which transforms expressions like from a in db.table select a into an expression tree which is then transformed into the necessary SQL for the actual DB call. Expression trees are also heavily used in the Dynamic Language Run-time.
As far as the specific example in your other post:
public IEnumerable<T> Find(Expression<Func<T, bool>> predicate)
Context is most likely a DbContext object. Set<T>() returns a DbSet<T> of all entities of the type given to Set. Then Where is called to filter the result based on the predicate expression which, instead of just being a lambda, is stored as an expression tree - I'm guessing because of some other logic elsewhere in the application otherwise this seems a little over-the-top.
EDIT: Forgot to add how to use them. In LINQ you treat it like any other function. Outside of LINQ you call Compile() to create the Func delegate. To create them is as simple as assigning a lambda in simple cases. For example, Expression<Func<int,int>> incrementTree = a => a + 1;. In more complex cases, you may need to explicitly use the expression tree API which you can find links to in the MSDN guide below.