Call this Code for Set File ReadOnly Mode using C#.Net:
public void SetReadOnly(string fileName)
{
FileInfo fi = new FileInfo(fileName);
fi.IsReadOnly = true;
}
{
FileInfo fi = new FileInfo(fileName);
fi.IsReadOnly = true;
}
h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->
| S.No | Custom Control | User Control |
|---|---|---|
| 1 | A loosely coupled control w.r.t code and UI. | A tightly coupled control w.r.t code and UI. |
| 2 | Derives from Control. | Derives from UserControl. |
| 3 | Defines UI in a ResourceDictionary. | Defines UI as normal XAML. |
| 4 | UI is skinable. | Child controls are skinable. |
| 5 | Has dynamic layout. | Has static layout. |
| 6 | UI can be changed in different projects. | UI is fixed and can't have different looks in different project. |
| 7 | Has full toolbox support. | Can't be added to the toolbox. |
| 8 | Defines a single control. | Defines a set of controls. |
| 9 | More flexible. | Not very flexible like a Custom Control. |
using Microsoft.Office.Interop.Outlook;
public static int CountOfUnreadMails()
{
Application OutlookApp = new Application();
NameSpace myMail = OutlookApp.GetNamespace("MAPI");
int unread = myMail.GetDefaultFolder(OlDefaultFolders.olFolderInbox).UnReadItemCount;
return unread;
}