Both allow you to stub out or define aspects of a class that you may know but not completely or you may not be the one ultimately filling in the functionality.
Interfaces allow you to specify what properties, methods, and events MUST be present on an object that conforms to that interface. Take, for example, INotityPropertyChanged. If an object implements that interface, then it MUST expose a PropertyChanged event with a specific signature. When another object wants to be notified that a property changed, it can inspect the target class to see if that interface is implemented and if so, hook the event. Because now you know what the event name and signature must be.
Interfaces, however, only specify the properties, events, and methods that a class must expose and a class may implement more than one interface. Abstract classes, however, have a bit more meat on their bones. They are actual classes but simply stub the method functionality leaving it to be implemented in a class that inherits from the abstract class. A good example might be a data access object that exposes some data stored in the database. You would define an interface for the class including the methods needed to get and save data. You might then create an abstract class that provides some basics but doesn't include any details on how to get to the database. Finally, you might create two or three concrete classes from the abstract class that each know how to connect to a specific database server... maybe one for SQL, another for Oracle, and a 3rd for NoSQL. At runtime you can use reflection to find the proper concrete class and load it. Your code works with only the interfaces but at runtime is provided with the concrete instance of the appropriate class.
Im trying to retrieve a part of a string (a filepath and name) from a field.
However when I do, c# "helpfully" automatically escapes the string.
So instead of the string: C:\folderpath\filename.doc
I end up with: C:\\folderpath\\filename.doc
I've tried using the string.Replace funciton to remove the extra rubbish, but nothing happens.
I've also tried using Regex, but it just complains that it doesnt know what "\f" is.
I've tried adding "@" to the beginning of the string retrieval, but that doesnt help either.
Im running a sql query
using (SqlCommand cmd = new SqlCommand("Select Address1, Address2, LinkedDoc, Recid from Contsupp2 Where Rectype = 'L' AND U_ADDRESS1 Like @param", conn))
cmd.Parameters.Add("param", SqlDbType.VarChar,10).Value = @"S:\RWE%";
using (SqlDataReader reader = cmd.ExecuteReader())
string strOrigFilePath = (reader.GetString(2).Substring(reader.GetString(2).IndexOf("FILENAME=") + 9));
Any suggestions as to how I can return a normal string without c# messing it up?
I am looking for a way to Autofill or auto generate a Bank Transfer form like this
I have a template in word now that i autofill using data i pull from an SQL DB but the problem is that the text in te letter isnt always the same size so or the data on the Transfer is lower or higher so i need another way to add the transfer form at the end of the letter
Is there a DLL available somewhere or a site where i can get info on programming this stuff.
What I am trying to do: I want to add a combobox to the datagridview , with some three items ,like a,b,c, and a last item to be : new, when the user seletcts the last item :new in the combobox , the combobox has to be removed or it should change to textbox allowing to enter a value.
Suggest me whichever is possible ,that should take a value.