Getting installed powershell version
27/05/2011 Leave a comment
Ok. you have powershell but you dont know what is the version of it ?
Just write “$host.version” than press enter 🙂
All my posts are provided "AS IS" with no warranties, and confer no rights.
27/05/2011 Leave a comment
Ok. you have powershell but you dont know what is the version of it ?
Just write “$host.version” than press enter 🙂
02/03/2011 Leave a comment
C# (before .net 4.0) does not support optional method arguments. However, there may be times when you are using components that were created in a language that supports optional arguments, such as legacy COM components or components created with Microsoft Visual Basic .NET.
class Example { public void Test() { object missing = Type.Missing; object urlblog = "http://blog.bugrapostaci.com"; VBTestService yourObject = new VBTestService(); // first parameter is url and other 3 are optional in definition of OptionalParameterFuction coded VB yourObject.OptionalParameterFuction(ref urlblog, ref missing, ref missing, ref missing, ref missing); } }
Happy Codding…
26/01/2011 Leave a comment
Here is a small example for getting day name of a date by specific culture:
DateTime startDate = DateTime.Now;
DateTime endDate = DateTime.Now.AddDays(2);
CultureInfo c = new CultureInfo("tr-TR");
string startDayName = c.DateTimeFormat.DayNames[(int)startDate.DayOfWeek];
string endDayName = c.DateTimeFormat.DayNames[(int)endDate.DayOfWeek];
Happy Tips.
23/01/2011 Leave a comment
When you try to getting type of Generic variable “T” you get this warning.Here is the sample :
class CauseWarning { public void make<T>(T value) { if (typeof(T) is Test) Console.Write("Something"); } } public class Test { }
Here is the solution:
class CauseWarning { public void make<T>(T value) { if (typeof(T).IsAssignableFrom(typeof( Test))) Console.Write("Something"); } } public class Test { }
Type.IsAssignableFrom Method Determines whether an instance of the current Type can be assigned from an instance of the specified Type.true if the c parameter and the current Type represent the same type, or if the current Type is in the inheritance hierarchy of c, or if the current Type is an interface that c supports. false if none of these conditions are the case, or if c is a null reference.
17/10/2010 Leave a comment
Sometimes you want to know whats happinging at the background or wonder which app or process using specific dll. Or may be like me when try to copy a dll getting error “DLL is used by another process” . So what now ?
Process Explorer is one of great tool for this.
Download: