Created
May 28, 2015 06:04
-
-
Save genuinelucifer/45a29b36ec4f5254ea21 to your computer and use it in GitHub Desktop.
Alternative to using type.replace with type.substring ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generat | |
| index 04b2f35..0c25c0a 100644 | |
| --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs | |
| +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs | |
| @@ -863,8 +863,8 @@ private void GeneratePropertySetter<T>(QualifiedType returnT | |
| { | |
| CSharpTypePrinter typePrinter = new CSharpTypePrinter(ctx.D | |
| string type = arrayType.CSharpType(typePrinter).Type; | |
| - WriteLine(string.Format("fixed ({0} __arrPtr = {1}.{2})", | |
| - type.Replace("[]","*"), Helpers.InstanceField, | |
| + WriteLine(string.Format("fixed ({0}* __arrPtr = {1}.{2})", | |
| + type.Substring(0,type.Length-2), Helpers.InstanceField, | |
| Helpers.SafeIdentifier(field.OriginalName))); | |
| WriteStartBraceIndent(); | |
| ctx.ReturnVarName = string.Format("__arrPtr"); | |
| @@ -990,8 +990,8 @@ private void GeneratePropertyGetter<T>(QualifiedType returnT | |
| { | |
| CSharpTypePrinter typePrinter = new CSharpTypePrinter(ctx.D | |
| string type = arrayType.CSharpType(typePrinter).Type; | |
| - WriteLine(string.Format("fixed ({0} __arrPtr = {1}.{2})", | |
| - type.Replace("[]", "*"), Helpers.InstanceField, | |
| + WriteLine(string.Format("fixed ({0}* __arrPtr = {1}.{2})", | |
| + type.Substring(0,type.Length-2), Helpers.InstanceField, | |
| Helpers.SafeIdentifier(field.OriginalName))); | |
| WriteStartBraceIndent(); | |
| ctx.ReturnVarName = string.Format("__arrPtr"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment