![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Is StringBuilder class Value type? Thanks a lot. "Frans Bouma [C# MVP]" wrote: Quote: > sameem wrote: Quote: > > Dear All > > > > up to my level that I have known the StringBuilder class is reference type. > > Someone telling that StringBuilder class is Value type. > > > > Hence I want to clarify which is right? and how? > It's a reference type. String is also a reference type (though it > behaves like a valuetype). To determine if a type is a valuetype or a > reference type, you can look into the MSDN, lookup the type's > documentation page, and you can see if it inherits from a class (except > when it inherits from System.ValueType) or it is a class itself -> > reference type, if it is a struct (e.g. Int32) or if it inherits from > System.ValueType, it is a value type. A struct automatically inherits > from System.ValueType, see reflector on System.Int32 for example. > > In general, a type which is mutable is likely to be a reference type, > or at least should be a reference type, according to MS guidelines. > > So first thing to check: documentation. > > FB > > -- > ------------------------------------------------------------------------ > Lead developer of LLBLGen Pro, the productive O/R mapper for .NET > LLBLGen Pro website: http://www.llblgen.com > My .NET blog: http://weblogs.asp.net/fbouma > Microsoft MVP (C#) > ------------------------------------------------------------------------ > |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Is StringBuilder class Value type? sameem wrote: Quote: > Dear All > > up to my level that I have known the StringBuilder class is reference type. > Someone telling that StringBuilder class is Value type. > > Hence I want to clarify which is right? and how? behaves like a valuetype). To determine if a type is a valuetype or a reference type, you can look into the MSDN, lookup the type's documentation page, and you can see if it inherits from a class (except when it inherits from System.ValueType) or it is a class itself -> reference type, if it is a struct (e.g. Int32) or if it inherits from System.ValueType, it is a value type. A struct automatically inherits from System.ValueType, see reflector on System.Int32 for example. In general, a type which is mutable is likely to be a reference type, or at least should be a reference type, according to MS guidelines. So first thing to check: documentation. FB -- ------------------------------------------------------------------------ Lead developer of LLBLGen Pro, the productive O/R mapper for .NET LLBLGen Pro website: http://www.llblgen.com My .NET blog: http://weblogs.asp.net/fbouma Microsoft MVP (C#) ------------------------------------------------------------------------ |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Is StringBuilder class Value type? Thanks a lot. "Frans Bouma [C# MVP]" wrote: Quote: > sameem wrote: Quote: > > Dear All > > > > up to my level that I have known the StringBuilder class is reference type. > > Someone telling that StringBuilder class is Value type. > > > > Hence I want to clarify which is right? and how? > It's a reference type. String is also a reference type (though it > behaves like a valuetype). To determine if a type is a valuetype or a > reference type, you can look into the MSDN, lookup the type's > documentation page, and you can see if it inherits from a class (except > when it inherits from System.ValueType) or it is a class itself -> > reference type, if it is a struct (e.g. Int32) or if it inherits from > System.ValueType, it is a value type. A struct automatically inherits > from System.ValueType, see reflector on System.Int32 for example. > > In general, a type which is mutable is likely to be a reference type, > or at least should be a reference type, according to MS guidelines. > > So first thing to check: documentation. > > FB > > -- > ------------------------------------------------------------------------ > Lead developer of LLBLGen Pro, the productive O/R mapper for .NET > LLBLGen Pro website: http://www.llblgen.com > My .NET blog: http://weblogs.asp.net/fbouma > Microsoft MVP (C#) > ------------------------------------------------------------------------ > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| When a class is both an inherited class of another, and alsoimplements an interface method | .NET General | |||
| win32_pingstatus class / dns class | PowerShell | |||
| Generic Class: Passing Data Type to Placeholder | .NET General | |||
| Re: Unable to cast COM object of type 'ADODB.RecordsetClass' to class type 'System.Object[]' | .NET General | |||
| Unable to find type [Drawing.Image]: make sure that the assembly containing this type is loaded | PowerShell | |||